Totally Dumb Dev Question

  • One dev just asked me

    "If you have a table with an autogen id column, and a datetime column which defaults to now() (dev speak for CURRENT_TIMESTAMP πŸ™‚ ) can you just insert rows without adding anything else?"

    Hmmm I thought sounds bizzare insert a row without adding any other data................:crazy:

    I don't think it would work.... how do you do the insert?

    You have to add something to the row to get it to generate an instance of a row and bind it to the table. i.e. a data item into a third column.

    (Time to educate with extreme predjudice) πŸ˜€

    --Shaun

    Hiding under a desk from SSIS Implemenation Work :crazy:

  • Hi Shaun

    Wasn't this a qotd earlier in the year?

    INSERT INTO table Default Values

    β€œWrite the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

    For fast, accurate and documented assistance in answering your questions, please read this article.
    Understanding and using APPLY, (I) and (II) Paul White
    Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden

  • Can't say I saw that one Chris, but I'll go check it out cheers.

    So it is possible :crazy: using

    INSERT INTO 'tablename' Default Values

    Amazing πŸ˜€ Them devs are not so dumb afterall. πŸ˜›

    --Shaun

    Hiding under a desk from SSIS Implemenation Work :crazy:

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

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