Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 Query

Author  Topic 

Peter99
Constraint Violating Yak Guru

498 Posts

Posted - 2011-08-02 : 18:30:59
How to write a query that display all tables name in one column and all columns name seperated by , in second column without using loop and cursor i.e

table1 | col1,col2,col3.....
table2 | col1,col2..........

Thanks

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-08-02 : 18:33:02
You can query the INFORMATION_SCHEMA.COLUMNS view and use a CSV function to get the desired output.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-08-03 : 01:10:23
see here for a way to generate csv

http://visakhm.blogspot.com/2010/01/multipurpose-apply-operator.html

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

Peter99
Constraint Violating Yak Guru

498 Posts

Posted - 2011-08-03 : 11:46:34
Thanks Tara and Visakh for your help.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-08-03 : 12:56:38
wc

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -