Totally Dumb Dev Question

  • Shaun McGuile

    SSCarpal Tunnel

    Points: 4111

    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:

  • ChrisM@Work

    SSC Guru

    Points: 186120

    Hi Shaun

    Wasn't this a qotd earlier in the year?

    INSERT INTO table Default Values

    [font="Arial"]β€œWrite the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw[/font]


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

  • Shaun McGuile

    SSCarpal Tunnel

    Points: 4111

    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 3 (of 3 total)

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