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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Current Record

Status
Not open for further replies.

Elroacho

Programmer
Apr 19, 2004
59
0
0
NZ
I want to write a trigger to run on a huge table after an insert. I wanted to know if there is some way of picking up the record that caused the insert (i.e. the new record), rather than scan all the records, so I can decide if I want to copty certain fields into another table.

Cheers,
Kevin.
 
don't know if this will work in interbase but in SQL server if you are doing this in a transaction you have access to the INSERTED and DELETED virtual tables.

The way to access them is as normal ...
Code:
SELECT * FROM INSERTED

... or ...
Code:
SELECT * FROM DELETED

... will give you the records that were deleted or inserted. As I said, might be only an SQL Server thing but check it out.

Regards,

Patrick
 
I think interbase uses NEW and OLD in the same way SQL Server uses INSERTED and DELETED.

Cheers for your response.

YNWA,
Kevin.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top