The Time Conversion

  • Comments posted to this topic are about the item The Time Conversion

  • Too funny.  I wish it returned an error instead.  One that says, "Dude!  Just because this is 2022, you shouldn't expect anything different here!" 😀

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Jeff Moden wrote:

    Too funny.  I wish it returned an error instead.  One that says, "Dude!  Just because this is 2022, you shouldn't expect anything different here!" 😀

    Then use straight CAST. The only reason to use TRY_CAST here is if you don't want an error returned.

    (Also, it's 2023 ; P )

  • This is a very good reminder that data validation is not just limited to the straight format.

  • TRY_CAST can be useful for simplifying error handling as it returns NULL rather than raising an error.

    😎

    Nice one Steve, maybe some people will read the documentation 😉

  • sknox wrote:

    This is a very good reminder that data validation is not just limited to the straight format.

    Yep... I totally get that but this is one of those places where I think it should still provide something other than NULL.  I know... that's just me.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Eirikur Eiriksson wrote:

    TRY_CAST can be useful for simplifying error handling as it returns NULL rather than raising an error. 😎

    Agreed but I've also found that it makes people complacent about figuring out when went wrong with the process that provides the data and beating on the providers to fix it.  If it ground stuff to a screeching halt, they'd find some way to get someone to fix the data instead of kicking the proverbial can down the road forever.

    Don't get me wrong... I love the feature because I can load the other 20 million rows but I always do the follow up to have someone clean up their junk process.  A lot of people don't because they're not even aware that a NULL can be either a NULL in the data or a NULL that TRY_CAST() created because of an actual error.  Even reading the actual documentation won't prevent people from doing stupid things with it.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 7 posts - 1 through 6 (of 6 total)

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