Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2004
    Posts
    12

    Unanswered: stored procedure default value question

    Is there a way inside a stored procedure to determine if a parameter defined with a default value was explicity passed the same value as the default vs. the parameter was omitted and you just got the default value.

    E.g. create procedure mysp_stuff @parm1 varchar(20)=NULL, @parm1 bit=0 as
    if (@parm1 is null)
    begin
    -- did we get the default or did the caller pass NULL
    end
    if (@parm2 = 0
    begin
    -- did we get the default or did the caller pass 0
    end
    GO

    EXEC mysp_stuff
    go
    EXEC mysp_stuff @parm1=NULL, @parm2=0
    go
    Nick

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Not that I've ever heard of.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  3. #3
    Join Date
    Mar 2004
    Posts
    12
    me either. thanks. I just needed a sanity check on that.
    Nick

  4. #4
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Why do you care?
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  5. #5
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Dude, this is NOT the forum to be looking for sanity checks.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  6. #6
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    You could always go here for an Insanity check...
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •