Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run new Trigger on old records

Status
Not open for further replies.

jojo79

Programmer
Oct 11, 2006
40
US
I just created a new trigger for a table, Is their a way to run the trigger on all of the previous records in the table? or should I be doing something else. the trigger is an insert trigger. It basically moves information to another table.
 
>>Is their a way to run the trigger on all of the previous records in the table

no, unless it is an update trigger and you do something like this
update table set id =id (basically update the whole table to the same value)

a trigger is event driven once something changes to the table (insert,delete,update) the trigger will fire

Denis The SQL Menace
SQL blog:
 
I would definetly not want to affect all the records inthe table in a trigger. If you write it that way, then it willhappen every tim ea record is inserted.

Put the update code into a SQL statement and run from query analyzer to update the existing records.

Questions about posting. See faq183-874
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top