Bug/False Positve in Find unused variables
grauenwolf
Posts: 8 Bronze 2
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.
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
Thanks -- there is a remaining issue to do with Refactor finding unused variables and we're working on fixing this.