How to return multiple value from function in sql ?

Forums SQLHow to return multiple value from function in sql ?
Staff asked 4 weeks ago

Answers (1)

Add Answer
Umang Ramani Marked As Accepted
Staff answered 4 weeks 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