O'Reilly logo

Guru's Guide to SQL Server™ Stored Procedures, XML, and HTML, The by Ken Henderson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Calling Stored Procedures

A good way of modularizing your trigger code and cutting down on redundancy is to place the code shared in common by multiple triggers into a stored procedure and call the stored procedure from the triggers. The problem with this is that the inserted and deleted logical tables aren't available from a stored procedure. However, remember that from the perspective of an AFTER trigger, the modifications that fired it appear to have already taken place. This is also true of any code the trigger calls, including stored procedures. So, stored procedures called by the trigger do indeed have access to the data in the inserted and deleted tables by way of the table itself. The trigger can pass them the information they need to ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required