I created a function and tried to run it, however there were various issues.
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
The errors:
Msg 2714, Level 16, State 3, Procedure Afisho_rankimin, Line 11
There is already an object named 'Afisho_rankimin' in the database.
Another msg:
Can not find column "dbo", or the user defined function, or aggregate "dbo.Afisho_rankimin", or the name is ambiguous
Can someone please help me with this?