多数用在迁移或者复制数据库后检查新数据库与源数据库的数据条目数是否一致,理论上来说,只要表的总数,和全部表中数据条目的总数一致,那么我们就认为迁移是成功的。
直接选中数据运行以下T-SQL即可
set nocount on
if object_id(N'tempdb.db.#temp') is not null
drop table #temp www.2cto.com
create table #temp (name sysname,count numeric(18))
insert into #temp
select o.name,i.rows
from sysobjects o,sysindexes i
where o.id=i.id and o.Xtype='U' and i.indid<2
select count(count) [Total Tables],sum(count) [Total Rows] from #temp
select * from #temp
set nocount off
转载于:https://blog.51cto.com/ihover/1958226