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.
| Author |
Topic |
|
gjohnso7
Starting Member
11 Posts |
Posted - 2009-04-30 : 12:12:11
|
| I need a SQL View that Shows TableNames, ColumnNames for the entire DB I am working with. I need to be able to export this to excel and use it as a reference.Table_Name, Column_Name, Data_Type |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2009-04-30 : 12:12:56
|
| SELECT * FROM INFORMATION_SCHEMA.COLUMNS |
 |
|
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2009-04-30 : 23:13:14
|
| use robvolk query and try this one for tablename and their respective columnnamesselect t.name as tablename,s.name as columnname from sys.tables tinner join sys.columns s on t.object_id = s.object_id |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2009-05-01 : 01:11:16
|
quote: Originally posted by bklr use robvolk query and try this one for tablename and their respective columnnamesselect t.name as tablename,s.name as columnname from sys.tables tinner join sys.columns s on t.object_id = s.object_id
No, just use the information_schema view as it provides everything already. Don't use the system tables unless there is something not available in the information_schema views.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Subscribe to my blog"Let's begin with the premise that everything you've done up until this point is wrong." |
 |
|
|
|
|
|