Home Forums SQL Server 2005 Administering How To Get Last Inserted Record Value In SQL Server RE: How To Get Last Inserted Record Value In SQL Server

  • >>A DATETIME column with DEFAULT GETDATE() will work for single-row inserts, but if multiple rows are inserted in the same statement they will all have the same value.

    Here is another incorrect statement too (actually more than one failure).

    1) That DEFAULT only helps if the INSERT doesn't explicitly state a value for the DATETIME column, which is certainly possible.

    2) You are at the mercy of the 3.33ms precision of the DATETIME datatype. A busy system could easily have more than one concurrent insert within that interval - both will receive the same datetime value.

    Best,
    Kevin G. Boles
    SQL Server Consultant
    SQL MVP 2007-2012
    TheSQLGuru on googles mail service