Skip to content

Instantly share code, notes, and snippets.

@jinan-kordab
Created May 28, 2018 23:46
Show Gist options
  • Save jinan-kordab/9879a3774da6ca1ed0f93ac626861a08 to your computer and use it in GitHub Desktop.
Save jinan-kordab/9879a3774da6ca1ed0f93ac626861a08 to your computer and use it in GitHub Desktop.
Second Instance in an example how to test and avoid SQL deadlock
--2
BEGIN TRAN;
Update TBL_test_temp_two set
TWOcolumnone =N'AAAAAAAA',
TWOcolumntwo =N'AAAAAAAAAAAAAA'
Where PK =1
And TWOcolumnone =N'AAAAAAAA'
AND TWOcolumntwo = N'AAAAAAAAAAAAAA'
COMMIT;
--4
BEGIN TRAN;
Update TBL_test_temp set
TESTCOLUMNONE =N'TTTTTTTT',
TESTCOLUMNTWO =N'TTTTTTTTTTTTTT'
Where PK =1
And TESTCOLUMNONE =N'TTTTTTTT'
AND TESTCOLUMNTWO = N'TTTTTTTTTTTTTT'
COMMIT;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment