if(@type=‘Delete_62’)
begin
if exists(select 0 from IR_RoomSpan where @RoomSpanID = (select top 1 RoomSpanID from IR_RoomSpan order by RoomSpanID desc))
begin
delete from IR_RoomSpan where RoomSpanID=@RoomSpanID
return
end
else
begin tran
delete from IR_RoomSpan where RoomSpanID=@RoomSpanID
update IR_RoomSpan set RoomSpanID = @RoomSpanID where RoomSpanID = (select top 1 RoomSpanID from IR_RoomSpan order by RoomSpanID desc)
select @@identity
commit tran
end
SQL 删除非标识规范的表,让主键按顺序排列
最新推荐文章于 2021-12-05 15:41:54 发布