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
 Old Forums
 CLOSED - General SQL Server
 Getting table information

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-06-02 : 08:12:14
Bhanu writes "How can i retrieve all the column names, datatypes,default values,Length of datatype of a table in sql server?"

robvolk
Most Valuable Yak

15732 Posts

Posted - 2005-06-02 : 08:13:05
SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='myTable'

There are over a dozen INFORMATION_SCHEMA views that provide system catalog information, Books Online has more details about them.
Go to Top of Page

kid_on_the_block
Posting Yak Master

172 Posts

Posted - 2005-06-04 : 01:32:54
I think you could simply say sp_help TableName ......
Go to Top of Page
   

- Advertisement -