• Kingston's solution is true enough as it goes, but you can also assign a default constraint to the update date column and then use this whenever a row is updated.

    As a demonstration:

    create table #t1 (Invoice_no int, item VARCHAR(5), price MONEY

    ,Inserted_date DATETIME DEFAULT GETDATE()

    ,Updated_date DATETIME DEFAULT GETDATE())

    insert into #t1 (invoice_no, item, price)

    select 102,'#1', 6.21

    union all select 102,'#2', 3.56

    union all select 102,'#3', 4.28

    union all select 105,'#4', 1.90

    union all select 105,'#5', 3.66

    union all select 107,'#6', 2.01

    SELECT Invoice_no, item, price, Inserted_date, updated_date

    FROM #T1

    UPDATE #T1

    SET price = 5.00

    ,updated_date = DEFAULT

    WHERE invoice_no = 107

    SELECT Invoice_no, item, price, Inserted_date, updated_date

    FROM #T1

    DROP TABLE #T1

    You would of course, just need to remember to do so, or force it to happen in a trigger.


    My mantra: No loops! No CURSORs! No RBAR! Hoo-uh![/I]

    My thought question: Have you ever been told that your query runs too fast?

    My advice:
    INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?
    The path of least resistance can be a slippery slope. Take care that fixing your fixes of fixes doesn't snowball and end up costing you more than fixing the root cause would have in the first place.

    Need to UNPIVOT? Why not CROSS APPLY VALUES instead?[/url]
    Since random numbers are too important to be left to chance, let's generate some![/url]
    Learn to understand recursive CTEs by example.[/url]
    [url url=http://www.sqlservercentral.com/articles/St