How to return multiple value from function in sql ?

Forums SQLHow to return multiple value from function in sql ?
Staff asked 3 years ago

Answers (1)

Add Answer
Umang Ramani Marked As Accepted
Staff answered 3 years ago

In general, SQL Server functions return just one parameter value. If we wish to return several values from a function, we must deliver numerous values in table format utilizing table-valued functions.

 

CREATE FUNCTION Testmultiplevalues (@UserId INT)
returns TABLE
AS
    RETURN
      (SELECT *
       FROM   userinformation
       WHERE  userid = @userId)

 

Subscribe

Select Categories