Date Spread across 2 years? - How to ??
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: Date Spread across 2 years? - How to ??

  1. #1
    Join Date
    Dec 1999
    Location
    Purgatory
    Posts
    346

    Date Spread across 2 years? - How to ??

    Hi,

    I need to populate a date column for a demo. Table has 100K rows. New column is 'LAST_PURCHASE_DATE'.

    I need to update the column with date from sysdate to sysdate - 2years.

    I'll be looking to code this earlier this morning, but would appreciate any pearls of wisdom.

    Thanks.

    Horace.

  2. #2
    Join Date
    Nov 2002
    Location
    Geneva Switzerland
    Posts
    3,142
    How about
    UPDATE my_table
    SET dateColumn = SYSDATE - MOD(ROWNUM, 730);

  3. #3
    Join Date
    Dec 1999
    Location
    Purgatory
    Posts
    346
    Thanks for the input DaPi.

    I must be getting better at this coding lark, 'cos that's exactly what I came up with.

    Ta.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width