Sybase 15 tips

--select next_identity
select next_identity('dbo.TblHNWSwapSuitability')

--fixing identity gap and reset "next_identity" to 1
exec sp_chgattribute 'TblHNWSwapSuitability', 'identity_burn_max', 0,'0'

--create new backup table and dump data to it from original table dynamically

drop table tb_bak

declare @desTb varchar(50)
declare @oTb varchar(50)

set @desTb = 'tb_bak'
set @oTb = 'tb'

execute('insert into '+@a+' select * from '+@b+' where key_date = 200609')

猜你喜欢

转载自no-123.iteye.com/blog/1947032