高手帮小弟分析一个带事务的存储过程?

suntrust_tdx suntrust_tdx 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
CREATE PROCEDURE p_set_time_send
AS
begin
SET XACT_ABORT ON
begin tran zhuanyidingshifasong
insert into tb_queue_list select * from tb_set_time_msg where send_time <= getdate()
delete from tb_set_time_msg where send_time <= getdate()
commit tran zhuanyidingshifasong
end
go

请大家帮我分析一下我写的这个带事务的存储过程有没有问题.
这个存储过程的功能:从一个表中把满足一定时间的数据,写到另一个表中.并把刚才满足条件的数据清空.
现在小弟有一点不明,请指点.就是通过insert into tb_queue_list select * from tb_set_time_msg where send_time <= getdate()写入的数据,会不会通过delete from tb_set_time_msg where send_time <= getdate()删除的数据不一样多.
会不会出现:在删除前又有满足条件的数据写入 tb_set_time_msg ,但这些数据没有被写入tb_queue_list. 说明 tb_queue_list,tb_set_time_msg结构一样.
...全文

相关推荐

评论 7
收藏 已收藏
分享
返回顶部
suntrust_tdx
MS-SQL Server 34,876 成员 254,635 内容