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 1, 2013 12:09 AM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Thursday, July 10, 2014 11:20 AM
Points: 1,888, Visits: 2,323
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


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Thursday, July 10, 2014 11:20 AM
Points: 1,888, Visits: 2,323
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
SSC-Addicted

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

Group: General Forum Members
Last Login: Saturday, July 19, 2014 12:54 AM
Points: 463, Visits: 416
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


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Thursday, July 10, 2014 11:20 AM
Points: 1,888, Visits: 2,323
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