用SQL语句如何制造死锁情况?
因为项目测试需要,要用SQL语句制造死锁情况,请问该SQL语句如何写?数据库是MSSQL
------解决方案--------------------select * from ta with (XLOCK)--排它鎖
------解决方案----------------------为表加排他锁,锁定5分钟
USE pubs
GO
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
GO
BEGIN TRANSACTION
SELECT * FROM authors WITH (TABLOCKX)
WAITFOR DELAY '00:05:00 '
COMMIT TRANSACTION
GO