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 |
|
nikita
Starting Member
7 Posts |
Posted - 2007-12-20 : 23:13:17
|
| Hi,I want to get a count of tables & user stored procedures in my databaseHow to do it?thank you |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-12-20 : 23:17:15
|
[code]SELECT COUNT(*) FROM sys.tablesSELECT COUNT(*) FROM sys.procedures[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
nikita
Starting Member
7 Posts |
Posted - 2007-12-20 : 23:20:46
|
| thank you friend..I tried SELECT COUNT(*) FROM sys.columns but it gives cumulative columns of all tables..how can i list count of columns, indexes for all tables in a database. If a db does not have index, count should be 0thank you |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-12-20 : 23:29:44
|
quote: I tried SELECT COUNT(*) FROM sys.columns but it gives cumulative columns of all tables..
This will give you a count of number of columns in database. What do you want actually ?this ?SELECT obj_name = object_name(object_id), no_of_columns = COUNT(*) FROM sys.columnsGROUP BY object_id quote: how can i list count of columns, indexes for all tables in a database. If a db does not have index, count should be 0
use left join on sys.tables to sys.indexes KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
|
|
|