False Positive for Find Unused Variables and Parameters

JMorganSmithJMorganSmith Posts: 2
edited April 6, 2009 12:34PM in SQL Refactor Previous Versions
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 and the following code (@LastID) is flagged as an unused variable:

SET @LastID = @LastID + @@ROWCOUNT


J. Morgan Smith
Senior BI Architect
Teksouth Corporation


  • Options
    Eddie DEddie D Posts: 1,788 Rose Gold 5
    Thank you for your post into the forum.

    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 Davis
    Senior Product Support Engineer
    Redgate Software Ltd
    Email: support@red-gate.com
Sign In or Register to comment.