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 |
|
jcb267
Constraint Violating Yak Guru
291 Posts |
Posted - 2009-05-07 : 13:35:55
|
| Does anyone know of a way to get a list of the tables included in a sql 2005 database? I have a database that has over 100 tables - some with very long names. I need a list of the tables that are included in the database. Any help would be greatly appreciated! |
|
|
sakets_2000
Master Smack Fu Yak Hacker
1472 Posts |
Posted - 2009-05-07 : 13:37:02
|
| select [name] from sysobjects where xtype='u' |
 |
|
|
jcb267
Constraint Violating Yak Guru
291 Posts |
Posted - 2009-05-07 : 13:41:32
|
| This works, thanks.I know there is about 100 tables in th db and this only shows 32. Do you know why? |
 |
|
|
sakets_2000
Master Smack Fu Yak Hacker
1472 Posts |
Posted - 2009-05-07 : 13:43:19
|
| 100 including system tables ? |
 |
|
|
sakets_2000
Master Smack Fu Yak Hacker
1472 Posts |
Posted - 2009-05-07 : 13:43:50
|
| this would incude everything,select [name] from sysobjects |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-05-07 : 13:44:48
|
| you can even use information_SCHEMA.tables viewSELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE='BASE TABLE' |
 |
|
|
sakets_2000
Master Smack Fu Yak Hacker
1472 Posts |
Posted - 2009-05-07 : 13:46:39
|
| also to include views, you can add rows with xtype='v', xtype='s' for system tables |
 |
|
|
jcb267
Constraint Violating Yak Guru
291 Posts |
Posted - 2009-05-07 : 13:47:29
|
quote: Originally posted by sakets_2000 this would incude everything,select [name] from sysobjects
Just user tables. I can see them, just don't want to have tpo type each one out! |
 |
|
|
sakets_2000
Master Smack Fu Yak Hacker
1472 Posts |
Posted - 2009-05-07 : 13:52:39
|
| then select [name] from sysobjects where xtype='u' or what viaskh gave you should list everything. |
 |
|
|
chriztoph
Posting Yak Master
184 Posts |
Posted - 2009-06-01 : 04:48:10
|
try this oneselect * from sys.tables |
 |
|
|
|
|
|