Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

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


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Monday, April 14, 2014 11:50 PM
Points: 1,869, Visits: 2,275
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 01, 2013 12:23 AM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Monday, April 14, 2014 11:50 PM
Points: 1,869, Visits: 2,275
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 01, 2013 12:31 AM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Today @ 3:44 AM
Points: 407, Visits: 385
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 01, 2013 1:32 AM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Monday, April 14, 2014 11:50 PM
Points: 1,869, Visits: 2,275
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