You could get the list of columns (comma separated list)for a table using this query. If you know the column names that you want to exclude , you could put them into the where clause in this query and later the column list can be used in dynamic query.
Hope this helps
select Stuff((select
','+c.name
from sys.columns c join
sys.tables t
on t.object_id=c.object_id
for xml xml path()),1,1,'')
Satheesh
No comments:
Post a Comment