22,209
社区成员
发帖
与我相关
我的任务
分享
create proc p_checkNum
as
if exists (select 1 from sysobjects where name = 'ABC')
begin
if (Select count(*) from ABC) = 100000 --统计记录数
begin
backup database 数据库 to disk='c:\11.bak'
end
end
--结果不准确,接近
select rows from sysindexes where id = object_id('ABC') and indid in (0,1)
--or 准确
select count(1) from ABC