Posted on
2004-07-19 15:09Cure
阅读(2017)
评论(3)
编辑收藏举报
获取当前数据库中所有表的记录数:
ifexists (select*from dbo.sysobjects where id =object_id(N'[dbo].[GetRecordCountsForAllTables]') andOBJECTPROPERTY(id, N'IsProcedure') =1) dropprocedure[dbo].[GetRecordCountsForAllTables] GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS OFF GO CREATEProcedure dbo.GetRecordCountsForAllTables AS select'Owner'=convert(char(10),t.TABLE_SCHEMA), 'Table Name'=convert(char(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' groupby t.TABLE_SCHEMA, t.TABLE_NAME GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO