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 |
vmurali
Yak Posting Veteran
88 Posts |
Posted - 2006-11-26 : 04:32:23
|
Hi, Is there any way to get the table definition (Table columns, Table Columndatatype , Columndatasize). Can we get it using a single sql statement specifying database, table name. |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-11-26 : 04:33:47
|
select * from information_schema.columns where table_name = '<your table name here>'Peter LarssonHelsingborg, Sweden |
|
|
vmurali
Yak Posting Veteran
88 Posts |
Posted - 2006-11-26 : 04:41:56
|
Thanks for your reply. Will this work for if i have to get values from tables present in different databases. I have a source1 and source 2 database and I have to get details with respect to individual databases.quote: Originally posted by Peso select * from information_schema.columns where table_name = '<your table name here>'Peter LarssonHelsingborg, Sweden
|
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2006-11-26 : 04:43:16
|
prefix information_schema with database name like this:select * from db1.information_schema.columns where table_name = '<your table name here>' Harsh AthalyeIndia."Nothing is Impossible" |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-11-26 : 23:49:58
|
Other method is to use sp_helpDbname..sp_help 'table name'MadhivananFailing to plan is Planning to fail |
|
|
|
|
|