omarserenity (11/13/2010)
I was wondering what the benefits were of having two separate functions for potentially returning all records if the primary key parameter is passed in as NULL, like:UFTBadmUser##PK (@AsOfDate, @userid)
UFTBadmUser#PK (@AsOfDate, @userid)
Why not just have the one function that uses
where (UserID = @user-id or @user-id is null)?
It can't be that much of a performance hit to check whether or not a parameter's value is null and why would you even have a @user-id parameter in the second function at all if the only time you would use it would be if you wanted to pass @user-id = null?
Actually there is quite a performance hit that occurs when you do the test for null. So there are two versions: one that allows you to get all records if you want, and a much faster one that requires an exact match on the key value(s).