Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to execute function in SQL Server

I build a function and I am trying to execute it…but some errors are occurring

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

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

The function is not being created. Try calling your function something else.

CREATE FUNCTION dbo.Afisho_rankimin1(@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_rankimin1(5) AS Rankimi 
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading