James Horsley
http://www.sqlservercentral.com/Forums/Topic865846-2623-3.aspx#bm866809
declare @tableName varchar(200) = 'TableToGetTheColsFor'
declare @cols varchar(max)
SET @Cols = ''
SELECT
@Cols = @Cols + CASE WHEN ORDINAL_POSITION = 1 THEN '' ELSE ',' END + COLUMN_NAME
FROM
INFORMATION_SCHEMA.COLUMNS
WHERE
TABLE_NAME=@tableName
SELECT @cols
No comments:
Post a Comment
- the first minus - Comments have to be moderated because of the spammers
- the second minus - I am very lazy at moderating comments ... hardly find time ...
- the third minus - Short links are no good for security ...
- The REAL PLUS : Any critic and positive feedback is better than none, so your comments will be published sooner or later !!!!