Converting time - from "seconds after midnight"

  • Thank you, Jason! I've not used STUFF before. Works great.

  • Did nobody see my solutions? My first one even I said had a problem with a leading zero but in my second posting I fixed that.

  • Sorry, Lynn. Appreciate your effort on this as well. I feel fortunate to have access to so many exceptional SQL minds; it's just fantastic.

    Thanks to everyone!

  • tacy.highland (12/2/2016)


    The only thing I have against these nice simple answers:

    As you can see, the neat thing about nice simple answers is that they're nice and simple to modify to your needs. 😉

    There's a whole lot of power in the functions of any language. If I need to learn a new language, one of the first things I do is to check the documentation for all the functions to see what's available. Unfortunately, SQL Server no longer installs "Books Online" by default nor do they provide it. You either have to download it or set it up to look on the web. It's definitely worth doing either way.

    --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 (12/3/2016)


    tacy.highland (12/2/2016)


    The only thing I have against these nice simple answers:

    As you can see, the neat thing about nice simple answers is that they're nice and simple to modify to your needs. 😉

    There's a whole lot of power in the functions of any language. If I need to learn a new language, one of the first things I do is to check the documentation for all the functions to see what's available. Unfortunately, SQL Server no longer installs "Books Online" by default nor do they provide it. You either have to download it or set it up to look on the web. It's definitely worth doing either way.

    And if you are on a closed (or secured) network with no access to the Internet, looking things up on the Internet is nonstarter out the gate.

  • Lynn Pettis (12/5/2016)


    Jeff Moden (12/3/2016)


    tacy.highland (12/2/2016)


    The only thing I have against these nice simple answers:

    As you can see, the neat thing about nice simple answers is that they're nice and simple to modify to your needs. 😉

    There's a whole lot of power in the functions of any language. If I need to learn a new language, one of the first things I do is to check the documentation for all the functions to see what's available. Unfortunately, SQL Server no longer installs "Books Online" by default nor do they provide it. You either have to download it or set it up to look on the web. It's definitely worth doing either way.

    And if you are on a closed (or secured) network with no access to the Internet, looking things up on the Internet is nonstarter out the gate.

    Absolutely agreed. It's a real pain. It's been a very long time since I had to work in such an installation but always made sure that the appropriate "Help" or even a hardcopy book was always available in such cases. And I always made sure they were the one's that provided it. I didn't want them to find a 9 x 7 X 2.5 book during a cavity search. 😉

    --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 (12/5/2016)


    Lynn Pettis (12/5/2016)


    Jeff Moden (12/3/2016)


    tacy.highland (12/2/2016)


    The only thing I have against these nice simple answers:

    As you can see, the neat thing about nice simple answers is that they're nice and simple to modify to your needs. 😉

    There's a whole lot of power in the functions of any language. If I need to learn a new language, one of the first things I do is to check the documentation for all the functions to see what's available. Unfortunately, SQL Server no longer installs "Books Online" by default nor do they provide it. You either have to download it or set it up to look on the web. It's definitely worth doing either way.

    And if you are on a closed (or secured) network with no access to the Internet, looking things up on the Internet is nonstarter out the gate.

    Absolutely agreed. It's a real pain. It's been a very long time since I had to work in such an installation but always made sure that the appropriate "Help" or even a hardcopy book was always available in such cases. And I always made sure they were the one's that provided it. I didn't want them to find a 9 x 7 X 2.5 book during a cavity search. 😉

    Hmmm.... are you really all that willing to claim you have room for that sized object in any particular body cavity? 😉

    Steve (aka sgmunson) 🙂 🙂 🙂
    Rent Servers for Income (picks and shovels strategy)

  • sgmunson (12/5/2016)


    Jeff Moden (12/5/2016)


    Lynn Pettis (12/5/2016)


    Jeff Moden (12/3/2016)


    tacy.highland (12/2/2016)


    The only thing I have against these nice simple answers:

    As you can see, the neat thing about nice simple answers is that they're nice and simple to modify to your needs. 😉

    There's a whole lot of power in the functions of any language. If I need to learn a new language, one of the first things I do is to check the documentation for all the functions to see what's available. Unfortunately, SQL Server no longer installs "Books Online" by default nor do they provide it. You either have to download it or set it up to look on the web. It's definitely worth doing either way.

    And if you are on a closed (or secured) network with no access to the Internet, looking things up on the Internet is nonstarter out the gate.

    Absolutely agreed. It's a real pain. It's been a very long time since I had to work in such an installation but always made sure that the appropriate "Help" or even a hardcopy book was always available in such cases. And I always made sure they were the one's that provided it. I didn't want them to find a 9 x 7 X 2.5 book during a cavity search. 😉

    Hmmm.... are you really all that willing to claim you have room for that sized object in any particular body cavity? 😉

    Heh... it's an occupational hazard. As we all know, every performance problem and process problem is the fault of the database and the SQL Server, right? DBAs get "bent over" like this every day. 😉

    --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 (12/5/2016)


    sgmunson (12/5/2016)


    Jeff Moden (12/5/2016)


    Lynn Pettis (12/5/2016)


    Jeff Moden (12/3/2016)


    tacy.highland (12/2/2016)


    The only thing I have against these nice simple answers:

    As you can see, the neat thing about nice simple answers is that they're nice and simple to modify to your needs. 😉

    There's a whole lot of power in the functions of any language. If I need to learn a new language, one of the first things I do is to check the documentation for all the functions to see what's available. Unfortunately, SQL Server no longer installs "Books Online" by default nor do they provide it. You either have to download it or set it up to look on the web. It's definitely worth doing either way.

    And if you are on a closed (or secured) network with no access to the Internet, looking things up on the Internet is nonstarter out the gate.

    Absolutely agreed. It's a real pain. It's been a very long time since I had to work in such an installation but always made sure that the appropriate "Help" or even a hardcopy book was always available in such cases. And I always made sure they were the one's that provided it. I didn't want them to find a 9 x 7 X 2.5 book during a cavity search. 😉

    Hmmm.... are you really all that willing to claim you have room for that sized object in any particular body cavity? 😉

    Heh... it's an occupational hazard. As we all know, every performance problem and process problem is the fault of the database and the SQL Server, right? DBAs get "bent over" like this every day. 😉

    Sorry to hear that, my friend... but I do understand... However, if they start threatening to insert a book in a body cavity, it may be time to find a safer alternative. Or, take the book forcefully from the person trying to bend you over and go threaten the developer you know ACTUALLY caused the grief... with the same fate... 😉

    Steve (aka sgmunson) 🙂 🙂 🙂
    Rent Servers for Income (picks and shovels strategy)

  • sgmunson (12/5/2016)


    Jeff Moden (12/5/2016)


    sgmunson (12/5/2016)


    Jeff Moden (12/5/2016)


    Lynn Pettis (12/5/2016)


    Jeff Moden (12/3/2016)


    tacy.highland (12/2/2016)


    The only thing I have against these nice simple answers:

    As you can see, the neat thing about nice simple answers is that they're nice and simple to modify to your needs. 😉

    There's a whole lot of power in the functions of any language. If I need to learn a new language, one of the first things I do is to check the documentation for all the functions to see what's available. Unfortunately, SQL Server no longer installs "Books Online" by default nor do they provide it. You either have to download it or set it up to look on the web. It's definitely worth doing either way.

    And if you are on a closed (or secured) network with no access to the Internet, looking things up on the Internet is nonstarter out the gate.

    Absolutely agreed. It's a real pain. It's been a very long time since I had to work in such an installation but always made sure that the appropriate "Help" or even a hardcopy book was always available in such cases. And I always made sure they were the one's that provided it. I didn't want them to find a 9 x 7 X 2.5 book during a cavity search. 😉

    Hmmm.... are you really all that willing to claim you have room for that sized object in any particular body cavity? 😉

    Heh... it's an occupational hazard. As we all know, every performance problem and process problem is the fault of the database and the SQL Server, right? DBAs get "bent over" like this every day. 😉

    Sorry to hear that, my friend... but I do understand... However, if they start threatening to insert a book in a body cavity, it may be time to find a safer alternative. Or, take the book forcefully from the person trying to bend you over and go threaten the developer you know ACTUALLY caused the grief... with the same fate... 😉

    Heh... you don't understand... the book IS the safer alternative. 😉

    --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 (12/5/2016)


    sgmunson (12/5/2016)


    Jeff Moden (12/5/2016)


    sgmunson (12/5/2016)


    Jeff Moden (12/5/2016)


    Lynn Pettis (12/5/2016)


    Jeff Moden (12/3/2016)


    tacy.highland (12/2/2016)


    The only thing I have against these nice simple answers:

    As you can see, the neat thing about nice simple answers is that they're nice and simple to modify to your needs. 😉

    There's a whole lot of power in the functions of any language. If I need to learn a new language, one of the first things I do is to check the documentation for all the functions to see what's available. Unfortunately, SQL Server no longer installs "Books Online" by default nor do they provide it. You either have to download it or set it up to look on the web. It's definitely worth doing either way.

    And if you are on a closed (or secured) network with no access to the Internet, looking things up on the Internet is nonstarter out the gate.

    Absolutely agreed. It's a real pain. It's been a very long time since I had to work in such an installation but always made sure that the appropriate "Help" or even a hardcopy book was always available in such cases. And I always made sure they were the one's that provided it. I didn't want them to find a 9 x 7 X 2.5 book during a cavity search. 😉

    Hmmm.... are you really all that willing to claim you have room for that sized object in any particular body cavity? 😉

    Heh... it's an occupational hazard. As we all know, every performance problem and process problem is the fault of the database and the SQL Server, right? DBAs get "bent over" like this every day. 😉

    Sorry to hear that, my friend... but I do understand... However, if they start threatening to insert a book in a body cavity, it may be time to find a safer alternative. Or, take the book forcefully from the person trying to bend you over and go threaten the developer you know ACTUALLY caused the grief... with the same fate... 😉

    Heh... you don't understand... the book IS the safer alternative. 😉

    Ruh Roh Reorge, Yikes, and Shiver Me Timbers! You sure do live dangerously... I'll refrain from asking what that book in the body cavity is a safer alternative to... I don't want to know...

    Steve (aka sgmunson) 🙂 🙂 🙂
    Rent Servers for Income (picks and shovels strategy)

  • sgmunson (12/6/2016)


    Jeff Moden (12/5/2016)


    sgmunson (12/5/2016)


    Jeff Moden (12/5/2016)


    sgmunson (12/5/2016)


    Jeff Moden (12/5/2016)


    Lynn Pettis (12/5/2016)


    Jeff Moden (12/3/2016)


    tacy.highland (12/2/2016)


    The only thing I have against these nice simple answers:

    As you can see, the neat thing about nice simple answers is that they're nice and simple to modify to your needs. 😉

    There's a whole lot of power in the functions of any language. If I need to learn a new language, one of the first things I do is to check the documentation for all the functions to see what's available. Unfortunately, SQL Server no longer installs "Books Online" by default nor do they provide it. You either have to download it or set it up to look on the web. It's definitely worth doing either way.

    And if you are on a closed (or secured) network with no access to the Internet, looking things up on the Internet is nonstarter out the gate.

    Absolutely agreed. It's a real pain. It's been a very long time since I had to work in such an installation but always made sure that the appropriate "Help" or even a hardcopy book was always available in such cases. And I always made sure they were the one's that provided it. I didn't want them to find a 9 x 7 X 2.5 book during a cavity search. 😉

    Hmmm.... are you really all that willing to claim you have room for that sized object in any particular body cavity? 😉

    Heh... it's an occupational hazard. As we all know, every performance problem and process problem is the fault of the database and the SQL Server, right? DBAs get "bent over" like this every day. 😉

    Sorry to hear that, my friend... but I do understand... However, if they start threatening to insert a book in a body cavity, it may be time to find a safer alternative. Or, take the book forcefully from the person trying to bend you over and go threaten the developer you know ACTUALLY caused the grief... with the same fate... 😉

    Heh... you don't understand... the book IS the safer alternative. 😉

    Ruh Roh Reorge, Yikes, and Shiver Me Timbers! You sure do live dangerously... I'll refrain from asking what that book in the body cavity is a safer alternative to... I don't want to know...

    Heh... how about what it feels like when I'm told that I absolutely have to stand up a new server capable of holding all databases from prod and that I'm required to do a nightly snapshot of the MDF/LDF/NDF files, detach all but certain excluded databases, find all MDF/LDF/NDF files for every database that we do want to attach, write the ATTACHes to figure out what each MDF file needs for LDF/NDF files because the snapshot copies live in a different folder structure on different drives than what prod originally has, drop all production privs, apply privs from staging and that it needs to be done within a week. So I burn a barrel of midnight oil to get'er done and then I'm told that they no longer have the need, which I originally disagreed with to begin with.

    That's the kind of misplaced Fid that I'm talking about. :blink::pinch::sick::crazy:

    --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)

  • As painful as that is, a book in any body cavity is going to be more painful and for a lot longer than it takes to waste your time. That said, I do hear ya... management seems to love making foolish choices, despite clear evidence that it's a bad idea.

    Steve (aka sgmunson) 🙂 🙂 🙂
    Rent Servers for Income (picks and shovels strategy)

  • sgmunson (12/6/2016)


    As painful as that is, a book in any body cavity is going to be more painful and for a lot longer than it takes to waste your time. That said, I do hear ya... management seems to love making foolish choices, despite clear evidence that it's a bad idea.

    OK, if body cavity does not work for you - you can aways opt for a tooth cavity.

    _____________
    Code for TallyGenerator

  • Sergiy (12/7/2016)


    sgmunson (12/6/2016)


    As painful as that is, a book in any body cavity is going to be more painful and for a lot longer than it takes to waste your time. That said, I do hear ya... management seems to love making foolish choices, despite clear evidence that it's a bad idea.

    OK, if body cavity does not work for you - you can always opt for a tooth cavity.

    I'm going to assume your teeth are one heck of a lot larger than mine... given that you think that inserting a book inside of a cavity in one of them is a viable option... never mind getting that book inside your mouth to begin with... 😉

    Steve (aka sgmunson) 🙂 🙂 🙂
    Rent Servers for Income (picks and shovels strategy)

Viewing 15 posts - 16 through 30 (of 43 total)

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