死锁不知道为什么
a事务 spid 58:Receive 'SN71333326','05CM14740','2015-1-1 0:00:00',1,'SH','SH037','SN-J-SH-2006-0064','2006-2-8 9:51:00','回收'
b处理 spid 53:select validdate from productdetail where prod_code='SN71420102' and prod_batc='05DM01240'
日志提示是
A事务:ResType:LockOwner Stype:'OR' Mode: X SPID:53 ECID:4 Ec:(0x322EE0C0) Value:0x2b354e20 Cost:(0/0)
B事务:ResType:LockOwner Stype:'OR' Mode: IS SPID:58 ECID:3 Ec:(0x3233E0C0) Value:0x1ebf27e0 Cost:(0/0)
-----------------------------------------------------------
事务A内容
alter proc yiding_Receive @pro_code nvarchar(30),@lot_no nvarchar(30),@expiry_date smalldatetime,
@qty float,@office nvarchar(20),@cust_code nvarchar(20),@ord_no nvarchar(20),@del_date smalldatetime,@status nvarchar(20)
as
SET XACT_ABORT ON
begin tran t
declare @id bigint,@comp_code nvarchar(20)
select top 1 @id=id from productdetail with (updlock) where last_stat='送货' and last_code=@ord_no and prod_code=@pro_code and prod_batc=@lot_no and prod_qty=@qty
update productdetail with (xlock) set cust_code=NULL,last_code=pre_code,last_stat=pre_stat where id=@id
update officeproductstocklist with (xlock) set orde_qty=orde_qty-1 where offi_code=@office and prod_code=@pro_code
if @@error>0
rollback
commit tran t
SET XACT_ABORT OFF