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 2008 Forums
 Transact-SQL (2008)
 Select All Columns From a Table in Specific Format

Author  Topic 

demoman
Starting Member

1 Post

Posted - 2009-07-29 : 13:25:55
I have found this script

SELECT SO.NAME AS "Table Name", SC.NAME AS "Column Name", SM.TEXT AS "Default Value"
FROM dbo.sysobjects SO INNER JOIN dbo.syscolumns SC ON SO.id = SC.id
LEFT JOIN dbo.syscomments SM ON SC.cdefault = SM.id
WHERE SO.xtype = 'U'
ORDER BY SO.[name], SC.colid

but it returns the column name like

Column Name
__________
Office
OfficeName
OfficeAddress

I need a script to select all of the tables column names in this format

Column Name
___________

Office, OfficeName, OfficeAddress


Thanks

bklr
Master Smack Fu Yak Hacker

1693 Posts

Posted - 2009-07-30 : 01:32:15
may be try like this
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=81254

Go to Top of Page
   

- Advertisement -