22,294
社区成员
发帖
与我相关
我的任务
分享select placeid = identity(int,@p,1),* into #newtmp
from #itmpdeclare @t int
set @t=100
if object_id('tempdb..#t1') is not null
drop table #t1
create table #t1(ID int identity,col1 int)
dbcc checkident('Tempdb..#t1',reseed,@t)
insert #T1
select top 5 ID from sysobjects
select * from #t1
/*
ID col1
----------- -----------
100 4
101 5
102 7
103 8
104 13
*/declare @seed int
declare @sql varchar(8000)
set @seed=10
--由于作用域的问题.所以用全局临时表.
set @sql='select id=identity(int,'+cast(@seed as varchar)+',1),* into ## from BOM'
exec (@sql)
select * from ##
drop table ##@p int