The following code snippets will be used to get column name in particular table.
USE DBNAME
DECLARE @Schema varchar(60), DECLARE @Table varchar(60), DECLARE @columns varchar(1000)
SET @Table = 'Table_Name' SET @Schema = 'Schema_Name'
SELECT @Columns = coalesce(@Columns + ', ', '') + column_name FROM INFORMATION_SCHEMA.Columns WHERE table_name = @Table and table_Schema = @Schema ORDER BY Ordinal_Position
SELECT @Columns
Regards, Kavitha N
|
No responses found. Be the first to respond and make money from revenue sharing program.
|