Get the number of records in the current database:
IF
?
exists
(
SELECT
?
*
?
From
? DBO.SYSOBJECTS?
WHERE
? id?
=
?
Object_id
(N
'
[DBO]. [GetRecordcountsForaLTables]]
'
)?
and
?
ObjectProperty
(ID,? n
'
ISPROCEDURE
'
)?
=
?
1
)
Drop
?
Procedure
?
[
DBO
]
.
[
GetRecordcountsForAllTables
]
Go
Set
? Quoted_identifier?
Off
?
Go
Set
? ANSI_NULLS?
Off
?
Go
Create
??
Procedure
? DBO.GETRECORDCOUNTSFORALLTABLES?
AS
SELECT
??
'
Owner
'
=
Convert
(
charr
(
10
), t.table_schema, ??????
'
TABLE? NAME
'
=
Convert
(
charr
(
25
), t.table_name), ??????
'
RECORD? Count
'
=
Max
(I.ROWS)
From
? sysindexes? i,? information_schema.tables? t
WHERE
? T. TABLE_NAME?
=
?
Object_name
(I.ID) ??????
and
? T. TABLE_TYPE?
=
?
'
Base? Table
'
group
?
BY
? t.table_schema,? T.TABLE_NAME
Go
Set
? Quoted_identifier?
Off
Go
Set
? ANSI_NULLS?
On
Go