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
 Transact-SQL (2000)
 Does SQL have a DESCRIBE function like Oracle?

Author  Topic 

Zim327
Yak Posting Veteran

62 Posts

Posted - 2006-07-19 : 09:56:45
In Oracle (PL-SQL) I can simply type:

desc sometable

And it will display all the name, datatype, data length etc of all the columns in that table.

Is there an equivalent function in T-SQL?

Thanks,


Best regards,
Zim
(Future Eternal Yak God Emperor)

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2006-07-19 : 09:59:39
no.
SQL has inforamtion_schema.columns view

select * from inforamtion_schema.columns
where table_name = 'YourTableName'




Go with the flow & have fun! Else fight the flow
blog thingie: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

rockmoose
SQL Natt Alfen

3279 Posts

Posted - 2006-07-19 : 10:04:21
kind of.

this works pretty well:
exec sp_help 'tablename'

there is also the undocumented:
exec sp_mshelpcolumns 'tablename'

rockmoose
Go to Top of Page

Zim327
Yak Posting Veteran

62 Posts

Posted - 2006-07-19 : 11:53:00
You guys are awesome!
this was just what I was looking for!
Thanks again,

Best regards,
Zim
(Future Eternal Yak God Emperor)
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2006-07-19 : 11:56:11
quote:

Future Eternal Yak God Emperor



Now that's funny!



Go with the flow & have fun! Else fight the flow
blog thingie: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

Zim327
Yak Posting Veteran

62 Posts

Posted - 2006-07-19 : 12:10:46
Thanks spirit1
I'm glad you liked my attempt at humor
do you think I could get them to add it under my display name? ;)

Best regards,
Zim
(Future Eternal Yak God Emperor)
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2006-07-19 : 12:16:59
honestly... you don't have a chance.



Go with the flow & have fun! Else fight the flow
blog thingie: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

Zim327
Yak Posting Veteran

62 Posts

Posted - 2006-07-19 : 13:09:06
LOL!
that's the story of my life...

Best regards,
Zim
(Future Eternal Yak God Emperor)
Go to Top of Page

rockmoose
SQL Natt Alfen

3279 Posts

Posted - 2006-07-19 : 16:23:08
Ahh,
but 100 years in the future and with great perseverence the title may be yours!
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-07-21 : 11:33:26
Other method. Hoghlight the table name in QA and press Alt+F1

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -