• niladri.primalink (7/4/2013)


    Hi All,

    In a table (sale.person) I have more than 9 lacs row. I have only three columns. I need to add a column by Orderdate (which I have done by Alter table). Next I want to fill up the rows with date which should be set as a Order.

    For example if the date of first row is 2013-07-04 then the date of the next row will be 2013-07-03 and so one.

    Is there any way so that I can do it easily?

    Considering that there have been only 7.35 lac days since the year "0000", I have to ask why you want to do this. Is it a test table that you're trying to populate? If so, please see the following...

    http://www.sqlservercentral.com/articles/Test+Data/88964/

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