Bug/False Positve in Find unused variables

grauenwolfgrauenwolf Posts: 8 Bronze 2
edited December 19, 2006 6:02AM in SQL Refactor Previous Versions
declare @AccountKey int
set @AccountKey = -1
Select top 1 @AccountKey = AccountKey From Account Where 1 = 0
print @AccountKey --Prints -1

This flags line 2 as value assigned but not used. This is in error because if line 3 doesn't return any rows, the value set in line 2 is retained.

Comments

Sign In or Register to comment.