SQL Server >> SQL Server Interview Questions and Answers - Faqs

  Tue, 07 Sep 2010 


 

Here we used TempDb as database. Use TempDB and execute the below statements, You will find comma separated names which are retrieved from SysColumns table from TempDb.

Here the coalesce function return the set of comma separated values.

Declare @TempItems varchar(8000)
select @TempItems = Coalesce(@TempItems + ', ', '') + Cast(name as varchar(10)) from syscolumns where xtype=56
select @TempItems

Advertisement