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: Today @ 4:17 AM
Points: 1,963, Visits: 2,407
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: Today @ 4:17 AM
Points: 1,963, Visits: 2,407
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
Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Today @ 1:31 AM
Points: 557, Visits: 447
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: Today @ 4:17 AM
Points: 1,963, Visits: 2,407
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