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

Trigger after Insert? Expand / Collapse
Author
Message
Posted Wednesday, September 24, 2008 1:40 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Tuesday, January 31, 2012 6:01 AM
Points: 41, Visits: 309
Dear all, I've a table that is modified daily and has a huge amount of data, and for performance issue, I need to insert the latest daily data into a another table to perform search operations with better spped, and so, I think I need to write a trigger after insert on the first table to insert the latest rows in the other table.
How can I do that?
Post #574943
Posted Wednesday, September 24, 2008 2:26 AM
SSC-Addicted

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

Group: General Forum Members
Last Login: Tuesday, December 24, 2013 4:42 AM
Points: 460, Visits: 2,523
From inside your trigger, you can access the INSERTED virtual table. This table will have the same structure as your main table and contain only the newly inserted data. You can then write an INSERT INTO statement which SELECTS columns FROM INSERTED.

.
Post #574963
Posted Wednesday, September 24, 2008 7:13 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Tuesday, July 8, 2014 4:17 AM
Points: 1,101, Visits: 5,279
and for performance issue, I need to insert the latest daily data into a another table to perform search operations with better spped


Have you created any indexes to improve the search?
Any horizontal partitions?

I feel, creating a new table is not a good idea, just for search operation. Trigger may cause performance issue.
Post #575162
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse