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 |
|
jobejufranz
Starting Member
33 Posts |
Posted - 2008-02-28 : 04:35:47
|
| Hi Guys,I have another question.Is there a query to display the structure of a certain table?e.g. display the columns, data type,...etc.TIA |
|
|
PeterNeo
Constraint Violating Yak Guru
357 Posts |
Posted - 2008-02-28 : 04:44:59
|
| try exec sp_help <tablename>or query using Information_Schema.Columns view (read about it in BOL) |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-02-28 : 04:52:14
|
| orsp_columns 'table_name'MadhivananFailing to plan is Planning to fail |
 |
|
|
jobejufranz
Starting Member
33 Posts |
Posted - 2008-02-28 : 05:38:50
|
Thanks PeterNeo and madhivananquote: exec sp_help <tablename>
works but notquote: sp_columns 'table_name'
Incorrect syntax near 'sp_columns'. |
 |
|
|
sunil
Constraint Violating Yak Guru
282 Posts |
Posted - 2008-02-28 : 05:54:08
|
quote: Originally posted by jobejufranz Thanks PeterNeo and madhivananquote: exec sp_help <tablename>
works but notquote: sp_columns 'table_name'
Incorrect syntax near 'sp_columns'. sp_columns 'table_name'is working fine. check if you are having any dot (.) when running sp_columns 'table_name' |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-02-28 : 06:08:33
|
| You should have executed alone or with EXEC if there are multiple queries to runRun this alonesp_columns <tablename>No errorsNow run withexec sp_help <tablename>sp_columns <tablename>You get errorAgaing run withexec sp_help <tablename>exec sp_columns <tablename>No errorMadhivananFailing to plan is Planning to fail |
 |
|
|
jobejufranz
Starting Member
33 Posts |
Posted - 2008-02-28 : 21:56:24
|
quote: Originally posted by madhivanan You should have executed alone or with EXEC if there are multiple queries to runRun this alonesp_columns <tablename>No errorsNow run withexec sp_help <tablename>sp_columns <tablename>You get errorAgaing run withexec sp_help <tablename>exec sp_columns <tablename>No errorMadhivananFailing to plan is Planning to fail
My sincere apology madhivanan, i was wrong.Everything works perfectly.Thanks a lot. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-02-29 : 05:27:30
|
| <<My sincere apology madhivanan, i was wrong.>>No problemMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|