http://beyondrelational.com/justlearned/posts/792/sql-server-to-get-comma-separated-value-for-every-column-name-in-tables-with-t-sql.aspx
DECLARE @listStr VARCHAR(MAX)
SELECT @listStr = COALESCE(@listStr+', ' ,'') + Name
FROM sys.columns
WHERE OBJECT_NAME(OBJECT_ID)='dat_groups'
SELECT @listStr
Monday, November 14, 2011
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment