I have a following Question to ask all of you:
Suppose you have a table named tblRoles with column named "RoleName". Now, construct a query that will select all the role names into a single varchar with commas, what will you do?
DECLARE @RoleName VARCHAR(8000)
SET @RoleName = ''
SELECT @RoleName = RoleName + ',' + @RoleName
FROM tblRoles
Suppose you have a table named tblRoles with column named "RoleName". Now, construct a query that will select all the role names into a single varchar with commas, what will you do?
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)