How To get Columns using Procedure

Jayakumars
Posted by Jayakumars under SQL Server category on | Points: 40 | Views : 733
CREATE Proc Test
@TableName varchar(200)
as
select stuff((SELECT ','+COLUMN_NAME + ''
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = @TableName for XML path ('')),1,1,'') as ColumnNames

Comments or Responses

Login to post response