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 |
|
kanagarajkumar
Starting Member
1 Post |
Posted - 2006-05-18 : 09:02:17
|
| Dear All,I need to capture the following in a single query. though i know the following to List all columns in all the tables Selectso.name "Table Name", sc.name "Field Name", st.name "Data Type", sc.length "Size",'Is Null' = CaseWhen sc.isnullable = 1 then 'Null'Else 'Not Null' EndFromsyscolumns sc,sysobjects so,systypes stWhereso.type = 'U' andsc.id = so.id and sc.xtype = st.xtype andso.status > 0 andst.xusertype <> 256 Table Name,Column name,Data Type & ( Size ),Index,Constraint Name,Constraint Type, Constraint Condition,Reference -Table / Stored procedure / Function / Triggers Thanks in Advance.RegardsKanagaraj Kumar v---------------------------------------Kanagaraj Kumar Vinoth Kumar" A moment will come after which every moment will be MINE, and I am sure about it" |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2006-05-18 : 09:08:07
|
| Take a look at the INFORMATION_SCHEMA views, especially:SELECT * FROM INFORMATION_SCHEMA.COLUMNSSELECT * FROM INFORMATION_SCHEMA.TABLESSELECT * FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTSIt does all the joins and such for you, and it is a standard method. Querying system tables directly is ill-advised, as their structures can change or their access restricted/prevented. |
 |
|
|
graz
Chief SQLTeam Crack Dealer
4149 Posts |
Posted - 2006-05-18 : 10:46:30
|
| (Moved to the Transact-SQL forum)===============================================Creating tomorrow's legacy systems today.One crisis at a time. |
 |
|
|
|
|
|
|
|