how do I set a UDfunction parameter as non-null

  • Ideally, it would have a default of getdate(), but since that's non-deterministic, I need to require a value.

    How can I swing this?

  • Just have your function deal with a null using coalesce,

    Not knowing what your function does , this will return datein + 10 days.

    Select @output = dateadd(dd, coalesce(@inParam,getdate()),10)

  • thanks, but that's still non-deterministic. I don't think you can have getdate() in the body of a UD Function at all.

  • You are correct you cannot use GETDATE() inside a UDF.  However, you CAN pass it as a parameter.  udf_GETDATE(@Today) where @Today was SET = to GETDATE()



    Good Hunting!

    AJ Ahrens


    webmaster@kritter.net

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply