• Try this little script I wrote to get the column names of a table in comma-delimited form. Code can be changed to do other formats. Check the Messages tab on the results after run for the text version. This has come in handy SOOOOOOO many times.

    USE <dbname>

    GO

    -- Simple column listing with brackets

    DECLARE @tablename varchar(100)

    DECLARE @colline varchar(4000)

    SET @tablename = '<TableName>'-- set to the table name you are interested in

    SET @colline = ''-- leave blank

    SELECT @colline=@colline + COLUMN_NAME + ',' FROM information_schema.columns

    WHERE TABLE_NAME = @tablename

    ORDER BY ORDINAL_POSITION

    SELECT SUBSTRING(@colline,1,len(@colline)-1)

    PRINT SUBSTRING(@colline,1,len(@colline)-1)