How to return multiple values from a function in sql server 2012?

In this post, we will discuss how to return multiple values from an SQL server function in SQL server 2012. Here my requirement is I want to return multiple values through function.
You can also check:
In this case, we have to define a Table-valued function. Below is the syntax.
ALTER function [dbo].[fnGetTags]
@DiscussionID BigInt
RETURN (SELECT TagID,TagName FROM Tags WHERE TAGID in (Select Top 1 TagID from DiscussionTags where DiscussionID= @DiscussionID))
To call this function you can use like below:
SELECT * FROM [dbo].[fnGetTags](1)
Hope this will be helpful.
Check out Best Alternative to InfoPath -> Try Now


New to Office 365 SharePoint Online? Get Office 365 Enterprise E3 Subscription & Try out all the features

(Installation & Features)

About Bijay Kumar

I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site

View all posts by Bijay Kumar →