Home Forums SQL Server 2005 T-SQL (SS2K5) How to make this block dynamic? RE: How to make this block dynamic?
sharath.chalamgari
SSCertifiable
Points: 5680
More actions
July 7, 2013 at 10:43 pm
#1630303
are you looking for something like this
exec ('select @liststr = coalesce(@liststr+'+''''+','+''''+' ,'+''''+''''+') + quotename(column_name)
from '+ @server + '.'+ @db+ '.information_schema.columns where table_name = '+ ''''+ @table+'''')