List of Columns of a Table in CSV Format
DECLARE @TABLE_NAME VARCHAR ( 128 ) DECLARE @SCHEMA_NAME VARCHAR ( 128 ) ----------------------------------------------------------------------- -- *** User Customisation -- Set up the name of the table here : SET @TABLE_NAME = 'Address' -- Set up the name of the schema here, or just leave set to 'dbo' : SET @SCHEMA_NAME = 'dbo' ----------------------------------------------------------------------- DECLARE @vvc_ColumnName VARCHAR ( 128 ) DECLARE @vvc_ColumnList VARCHAR ( MAX ) IF @SCHEMA_NAME = '' BEGIN PRINT 'Error : No schema defined!' RETURN END IF NOT EXISTS ( SELECT * FROM sys . tables T JOIN sys . schemas S ON T . schema_id = S . schema_id WHERE T . Name = @TABLE_NAME AND S . name = @SCHEMA_NAME ) BEGIN PRINT 'Error : The table ''' + @TABLE_NAME + ''' in ...