I have the following code:
DECLARE @CTRBOOKCODES AS TABLE_TEMP_CODE_NVARCHAR_100
INSERT INTO @CTRBOOKCODES
SELECT CODE FROM (VALUES(
--'FUTURE' ),(
'ZZZZZ' ),(
--'NONE' ),(
'ZZZZ' ),(
'ZZZ' ),(
'ZZZ' ),(
'ZZZ' ),(
'ZZZ' ),(
'ZZZZ' ),(
'ZZZZ' ),(
'ZZZZ' ),(
'ZZZZ' ),(
'ZZZZZ' ),(
'ZZZZ' ),(
'ZZZZ' ),(
'ZZZZ' ),(
'ZZZ' ),(
'ZZZ' ),(
'ZZZZZ' ),(
'ZZZ' ),(
'ZZZ' ),(
'ZZZ ZZZZ' ),(
'ZZZ ZZZZ' )
) as TBL(CODE)
Then I get the following error:
Msg 1205, Level 13, State 55, Server SRVDEV\SQLEXPRESS2012, Line 65535
Transaction (Process ID 51) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
I am not sure what I'm doing wrong?
Why is mssql complaining about deadlocks, when there is no other process running that accesses the declared variable!