Friday, 28 March 2014

Sample Table Value Function in SQL

Sample Table Value Function in SQL :
CREATE FUNCTION MyTestFunc
(
@UserId INT
)
returns table as
return
(
Select * from User_Info_Master WHERE UserId=@userId
)

We can call this function in our query like as shown below:
SELECT * FROM dbo.MyTestFunc(14)