aspdotnet-suresh offers articles and tutorials,csharp dot net, articles and tutorials,VB.NET Articles,Gridview articles,code examples of 2.0 /3.5,AJAX,SQL Server Articles,examples of .net technologies

Can Function Return a Table in SQL Server 2008 or Can SQL Function return a table as Parameter

Sep 14, 2013

Here I will explain how SQL Server function will return table as parameter in SQL Server 2008 or can SQL function return a table as parameter in SQL Server 2008.    


Whether functions will return table as parameter or not?

For this question answer will be Yes functions will return table as parameter by using table valued parameters.  

Generally SQL Server functions will return only one parameter value if we want to return multiple values from function then we need to send multiple values in table format by using table valued functions.

Sample function which return table as parameter

CREATE FUNCTION testmultiplevalues
@UserId INT
returns table as
Select * from UserInformation WHERE UserId=@userId
We can call this function in our query like as shown below

SELECT * FROM dbo.testmultiplevalues(14)
If we run above query we will get output like as shown below


If you enjoyed this post, please support the blog below. It's FREE!

Get the latest,, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email.

subscribe by rss Subscribe by RSS subscribe by email Subscribe by Email


Rad Shashank said...

Nice code

Rajiv Nayan said...


I want to store (/mm³) inplace of 3 i want to store 5 in sqlserver 2005. what is the code of sqlserver.
Please reply to my mail id

Give your Valuable Comments

Other Related Posts

© 2015 All Rights Reserved.
The content is copyrighted to Suresh Dasari and may not be reproduced on other websites without permission from the owner.