SELECT @RoleName = RoleName + ',' + @RoleName

Will you use cursor, loop or ???

    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

posted on 2004-07-06 12:39  火星工作室  阅读(759)  评论(0)    收藏  举报

导航