Saturday, June 10, 2006

Sql Server number of tables, procedures etc

Use db1
select count(*) from sysobjects where xtype = 'U' and status > 0
select count(*) from sysobjects where xtype = 'P' and status > 0
Use db2
select count(*) from sysobjects where xtype = 'U' and status > 0
select count(*) from sysobjects where xtype = 'P' and status > 0

Here xtype can also be
Object type. Can be one of these object types:
C = CHECK constraint
D = Default or DEFAULT constraint
F = FOREIGN KEY constraint
L = Log
FN = Scalar function
IF = Inlined table-function
P = Stored procedure
PK = PRIMARY KEY constraint (type is K)
RF = Replication filter stored procedure
S = System table
TF = Table function
TR = Trigger
U = User table
UQ = UNIQUE constraint (type is K)
V = View
X = Extended stored procedure

No comments: