Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Unused Input Parameters Expand / Collapse
Author
Message
Posted Wednesday, December 19, 2012 2:51 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Friday, November 14, 2014 10:40 AM
Points: 371, Visits: 735
Comments posted to this topic are about the item Unused Input Parameters
Post #1398254
Posted Wednesday, December 19, 2012 10:22 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, March 19, 2014 7:04 AM
Points: 5, Visits: 78
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.
Post #1398537
Posted Wednesday, December 19, 2012 10:32 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Friday, November 14, 2014 10:40 AM
Points: 371, Visits: 735
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! :)
Post #1398548
Posted Wednesday, February 26, 2014 2:36 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Friday, October 10, 2014 6:11 AM
Points: 17, Visits: 14
What is the harm of having these Unused Parameters? Is this just for cleaning up your code?
Post #1545596
Posted Wednesday, February 26, 2014 4:13 PM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Friday, November 14, 2014 10:40 AM
Points: 371, Visits: 735
No harm, just cleaner code.
Post #1545635
Posted Thursday, October 9, 2014 1:26 PM
Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Yesterday @ 6:30 AM
Points: 3,665, Visits: 317
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?
Post #1624420
Posted Thursday, October 9, 2014 1:53 PM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Friday, November 14, 2014 10:40 AM
Points: 371, Visits: 735
Optional in a manner of speaking by setting default values. A good example is sp_who2.
Post #1624429
Posted Friday, November 7, 2014 2:36 PM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Today @ 9:34 AM
Points: 71, Visits: 829
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.
Post #1631792
Posted Friday, November 7, 2014 4:04 PM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Friday, November 14, 2014 10:40 AM
Points: 371, Visits: 735
Glad to hear it. :)
Post #1631803
Posted Friday, November 7, 2014 4:04 PM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Friday, November 14, 2014 10:40 AM
Points: 371, Visits: 735
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. ;)
Post #1631804
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse