Aspdotnet-Suresh

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

SQL Server - Can Function Return Multiple Values in SQL Server 2008

Sep 1, 2013
Introduction:

Here I will explain how SQL Server function will return multiple values in SQL Server 2008 or return multiple values from SQL user defined function in SQL Server 2008.    

Description:


Whether functions will return multiple values or not?

For this question answer will be Yes functions will return either single or multiple values.  

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
return
(
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

Demo

 

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

Get the latest Asp.net, C#.net, 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

12 comments :

Unknown said...

Hello Sir,
Again Your Code Become Helpful for me
Thankyou Sir.

Anonymous said...

Hi I'm web developer and I find very interesting and useful your interview questions section.
Thank you

Anonymous said...

Hi I 'm web developer and I find very interesting and useful your interview questions section. Please Add more question and answer

Thanks

Anonymous said...

Hi Suresh,

Your website is very very useful. Please continue to support.

Unknown said...

hai sir...u r way of telling is very simple and easy understable...please add experince interview questionssssss

YOGESH ARVI said...

thank u friend ..ur topics are very helpfull to us ..keep on posting the topics ..

Parthi said...

Thanks for your posting tutor....

Unknown said...

thanks ..sir your code is very helpful...

Arunprasanth K V said...

Really your website is very helpful.Thank u so much for your support sir...

Telugu Upakarini said...

Thank you for Sharing..

Unknown said...

very good to understand

Anonymous said...

very good

Give your Valuable Comments

Note: Only a member of this blog may post a comment.

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