Coalesce keyword
Coalesce keyword is useful for fetching first non null value. Using this concept we can make comma separated values from the column.
Declare @output varchar(500) select @output = coalesce(@output + ', ' , '') + ename FROM employeemaster print @output
Output:
ranga, swati, anil, john, Kavitha, padma
This is one of the SQL Server Interview Question.
Post a Comment
Please give your valuable feedback on this post. You can submit any ASP.NET article here. We will post that article in this website by your name.