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 |
|
Dinky
Starting Member
37 Posts |
Posted - 2008-04-23 : 12:08:02
|
| How to query Table and its column details |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2008-04-23 : 12:13:32
|
| Select * from information_schema.columns where table_name = 'foo'or sp_help 'foo'Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
jen
Master Smack Fu Yak Hacker
4110 Posts |
Posted - 2008-04-25 : 04:46:06
|
| in 2005, it is recommended to use sys views...add as many column names you want to seeselect c.name as column_name,t.name as data_type,c.max_length,c.precision,c.scale,c.collation_namefrom sys.columns cjoin sys.types t on c.user_type_id=t.user_type_idwhere object_id=object_id('tablename')--------------------keeping it simple... |
 |
|
|
|
|
|