Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Query suggestion Expand / Collapse
Author
Message
Posted Monday, July 1, 2013 12:09 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Friday, April 1, 2016 1:02 AM
Points: 2,167, Visits: 2,726
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/
Post #1468934
Posted Monday, July 1, 2013 12:23 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Friday, April 1, 2016 1:02 AM
Points: 2,167, Visits: 2,726
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/
Post #1468936
Posted Monday, July 1, 2013 12:31 AM
Right there with Babe

Right there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with Babe

Group: General Forum Members
Last Login: Friday, February 26, 2016 6:29 AM
Points: 774, Visits: 509
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.
Post #1468941
Posted Monday, July 1, 2013 1:32 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Friday, April 1, 2016 1:02 AM
Points: 2,167, Visits: 2,726
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/
Post #1468958
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse