时间:2021-07-01 10:21:17 帮助过:2人阅读
测试过没有问题的
--已经测试没有问题的生成有标识列(自增ID)的表名 declare @tablename varchar(50) declare @sql varchar(1000) declare @objiecid int declare cur cursor for select object_id from sys.columns where is_identity=1 open cur fetch next from cur into @objiecid while @@fetch_status=0 begin select @tablename=name from sys.tables where object_id=@objiecid --print @tablename print ‘dbcc checkident(‘‘‘+@tablename+‘‘‘,reseed)‘ fetch next from cur into @objiecid end close cur deallocate cur
利用SQL语句重置数据库中所有表的标识列(自增量)
标签: