1
。identity 函数中不能用变量作参数
declare @a int
select @a=190
select identity(int,@a,1) as id,* into #temp from tablename
select * from #temp
上述不正确
,可以用如下方法
declare @a int
set @a=190
//首先把结构赋值过去
select identity(int,1,1) as id,* into #temp1from tablename where 1=2
//改变初始值
dbcc checkident(#temp1,reseed,@a)
insert into #temp1 select * from tablename
select * from #temp1
2
。要想让自增字段从1开始
,可以
dbcc checkident(tablename,reseed,0)
希望这篇
改变自增字段的初始值的文章能够对您有所帮助,如果您觉得这篇网站维护教程有用的话,别忘了推荐给您的朋友哦!如果您有好的经验方法,不妨拿出来和大家一起分享:假如每个人都拿出一个经验,那么我们都将额外的获取一堆他人的经验。
请记住本站永久域名:(黑客防线网安服务器维护方案维护基地)Www.Rongsen.Com.Cn