Red Gate forums :: View topic - False Positive for Find Unused Variables and Parameters
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SQL Refactor 1
SQL Refactor 1 forum

False Positive for Find Unused Variables and Parameters

Search in SQL Refactor 1 forum
Post new topic   Reply to topic
Jump to:  
Author Message
JMorganSmith



Joined: 03 Apr 2009
Posts: 1

PostPosted: Fri Apr 03, 2009 12:21 am    Post subject: False Positive for Find Unused Variables and Parameters Reply with quote

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:

Code:
DECLARE @LastID INT

SET @LastID = @LastID + @@ROWCOUNT

DBCC CHECKIDENT( 'TABLE_NAME_here', RESEED, @LastID)


Thanks
_________________
J. Morgan Smith
Senior BI Architect
Teksouth Corporation
Back to top
View user's profile Send private message
eddie davis



Joined: 14 Jun 2006
Posts: 940
Location: Red Gate Software

PostPosted: Mon Apr 06, 2009 5:34 pm    Post subject: Reply with quote

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
_________________
Eddie Davis
Technical Support Engineer
Red Gate Software Ltd
E-mail: support@red-gate.com
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group