title: How to execute function in SQL Server 2008
body: <p>I build a function and I am trying to execute it...but some errors are occurring</p>
  
  <pre><code>CREATE FUNCTION dbo.Afisho_rankimin(@emri_rest int)
  RETURNS int
  AS
     BEGIN
         Declare @rankimi int
         Select @rankimi=dbo.RESTORANTET.Rankimi
         From RESTORANTET
         Where  dbo.RESTORANTET.ID_Rest=@emri_rest
         RETURN @rankimi
    END
    GO
      SELECT dbo.Afisho_rankimin(5)AS Rankimi
    GO
  </code></pre>
  
  <p>The errors when I execute it are:</p>
  
  <blockquote>
    <p>Msg 2714, Level 16, State 3, Procedure Afisho_rankimin, Line 11<br>
    There is already an object named 'Afisho_rankimin' in the database.</p>
  </blockquote>
  
  <p>and also it is said that:</p>
  
  <blockquote>
    <p>Can not find column "dbo", or the user defined function, or aggregate "dbo.Afisho_rankimin", or the name is ambiguous</p>
  </blockquote>