December 19, 2012 at 2:51 am
Comments posted to this topic are about the item Unused Input Parameters
December 19, 2012 at 10:22 am
Nice! I've been thinking about this as well. But the problem has been how to exclude comments in the query of the module definition. For example, if I've got a @ParamA parameter that's not used in the code but is included in a comment, I still want this reported since the parameter isn't used. It just happens to be referenced in a comment.
December 19, 2012 at 10:32 am
Very interesting! I had not considered this. The issue would be identifying such a case since comments can be in many different forms:
--@my_unused_parameter
-- @my_unused_parameter
-- need to clean this up one day! -> @my_unused_parameter
/* @my_unused_parameter */
/*
@my_unused_parameter
*/
Etc... You've given me some food for thought. Thanks for sharing! 🙂
February 26, 2014 at 2:36 pm
What is the harm of having these Unused Parameters? Is this just for cleaning up your code?
February 26, 2014 at 4:13 pm
No harm, just cleaner code.
October 9, 2014 at 1:26 pm
Sean Smith-776614 (2/26/2014)
No harm, just cleaner code.
It must cost something for the system to prepare for the possibility that this unused parameter may be passed in. Or is it such a miniscule amount of time and space that it isn't even worth thinking about?
I would assume the calling procedures still need to be passing in values, even though they are just ignored by the stored procedure, unless they are optional parameters. Does t-sql allow optional parms?
October 9, 2014 at 1:53 pm
Optional in a manner of speaking by setting default values. A good example is sp_who2.
November 7, 2014 at 2:36 pm
In our case some of these parameters were meant to be implemented, perhaps as filters or whatever, but never were. This is pretty useful to me.
November 7, 2014 at 4:04 pm
Glad to hear it. 🙂
November 7, 2014 at 4:04 pm
I've actually found a lot of code with unused parameters. Seems developers modify the code over time and forget to take stuff out. Can add for a bit of confusion to say the least. 😉
December 22, 2015 at 6:35 am
Thanks for the script. I see someone already addressed the comment issue.
December 22, 2015 at 10:08 am
My pleasure. Hope it helps out! 🙂
April 26, 2016 at 6:57 am
After a bit of research found we do this here. Our problem is that of all the calls that have to be fixed too. We have to decide if it is worth the effort.
Viewing 13 posts - 1 through 12 (of 12 total)
You must be logged in to reply to this topic. Login to reply