False Positive for Find Unused Variables and Parameters
JMorganSmith
Posts: 2
I have seen several examples in these forums of people posting where they received false positives for unused variables, but most of them were using versions previous to v1.3.x
However, I did find one posting regarding table variables where the person was using the latest version.
I have version 1.3.0.207 and the following code (@LastID) is flagged as an unused variable:
Thanks
However, I did find one posting regarding table variables where the person was using the latest version.
I have version 1.3.0.207 and the following code (@LastID) is flagged as an unused variable:
DECLARE @LastID INT SET @LastID = @LastID + @@ROWCOUNT DBCC CHECKIDENT( 'TABLE_NAME_here', RESEED, @LastID)
Thanks
Comments
Using the code sample, I can recreate the reported fault symptoms.
However when I execute your sample code I get the following error:
Msg 2560, Level 16, State 9, Line 3
Parameter 3 is incorrect for this DBCC statement.
This indicates that the DBCC CHECKIDENT command is valid but does not like the way you have called the third parameter.
I suspect this is the reason why SQL Refactor thinks that your parameter @LastID is unused.
Many Thanks
Eddie
Senior Product Support Engineer
Redgate Software Ltd
Email: support@red-gate.com