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 2000 Forums
 SQL Server Development (2000)
 QUERY that returns table specifics

Author  Topic 

sinapra
Starting Member

24 Posts

Posted - 2006-11-20 : 09:16:36
Hello everyone

Can anyone help me by telling me whats the query that returns the column names, datatype, length and other properties without table data.

Thanks in Advance
Nagu

Cheers

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-11-20 : 09:22:54
[code]sp_help 'tablename'[/code]

where tablename is the name of the table you want information for.

or

[code]SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'tablename'[/code]

Harsh Athalye
India.
"Nothing is Impossible"
Go to Top of Page

sinapra
Starting Member

24 Posts

Posted - 2006-11-20 : 09:32:49
Thanks a lot Harsh, that really helps, but that didnot return the length of the datatype except Char type.

Cheers
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-11-20 : 09:38:49
Have you checked the sp_help procedure?

Harsh Athalye
India.
"Nothing is Impossible"
Go to Top of Page

sinapra
Starting Member

24 Posts

Posted - 2006-11-20 : 09:48:38
Harsh, I just did and got that as well, thanks again, but one more small one before I give a final touch

I tried this in Query Analyzer and extracted the info in CSV, but how to get it done in Enterprise manager, I mean running query is fine, but can it be saved thru enterprise manager.

Thanks again in advance
Prasad

Cheers
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-11-20 : 10:08:19
I don't think so.

Harsh Athalye
India.
"Nothing is Impossible"
Go to Top of Page
   

- Advertisement -