Unused Input Parameters

  • Comments posted to this topic are about the item Unused Input Parameters

  • 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.

  • 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

    -- need to clean this up one day! -> @my_unused_parameter

    /* @my_unused_parameter */




    Etc... You've given me some food for thought. Thanks for sharing! 🙂

  • What is the harm of having these Unused Parameters? Is this just for cleaning up your code?

  • No harm, just cleaner code.

  • 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?

  • Optional in a manner of speaking by setting default values. A good example is sp_who2.

  • 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.

  • Glad to hear it. 🙂

  • 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. 😉

  • Thanks for the script. I see someone already addressed the comment issue.

  • My pleasure. Hope it helps out! 🙂

  • 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