• AndrewSQLDBA (7/26/2013)


    Hello Everyone

    I am trying something, that I am not sure is possible.

    I have a CreateDate column in a table, there are approx 5000 rows with the same date and time. This was done from the data load. I need to change the the time by adding one millisecond to each one, but incrementing by one from the previous row.

    So if I have a datetime like this:

    RowID, CreateDate

    1, 2013-07-30 08:20:40:010

    2, 2013-07-30 08:20:40:010

    3, 2013-07-30 08:20:40:010

    4, 2013-07-30 08:20:40:010

    5, 2013-07-30 08:20:40:010

    I would like to add one millisecond to each, but incrementing from the previous row.

    ...

    Think of it in a different way - add RowID-1 milliseconds to your datetime2 value.


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/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]