declarecurcursorforselectnamefromsys.tables
opencur
fetchnextfromcurinto@tablename
while@@fetch_status=0
begin
set@sql=if(selectcount(1)from+@tablename+)<=0andexists(select*fromsys.columnswhereis_identity=1andobject_id=object_id(+@tablename+))
begin
dbcccheckident(+@tablename+,reseed,1)
end
exec(@sql)
fetchnextfromcurinto@tablename
end
closecur
deallocatecur