Query suggestion

  • I have a table A (VoucherNo) and

    table B (VoucherNo, ModifiedDate)

    What I want is whenever any voucherno gets inserted in table A, I have to modify the column modifydate of table B with current date as table B contains all the vouchers list in column voucherno...

    Please suggest me way to achive this..

    _______________________________________________________________
    To get quick answer follow this link:
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

  • Is this approach is right?

    If I create a trigger on table A and insert those voucherno into another tableC...after that using JOIN I can update column modifieddate of table B and then truncate the tableC

    _______________________________________________________________
    To get quick answer follow this link:
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

  • You can create a trigger on Table A and update the Table B directly, why to create Table C just for later joining it with TableB.

  • Bhaskar.Shetty (7/1/2013)


    You can create a trigger on Table A and update the Table B directly, why to create Table C just for later joining it with TableB.

    thanks Bhaskar, magic tables idea slipped from my mind...

    _______________________________________________________________
    To get quick answer follow this link:
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply