15 Stored Procedures and Triggers

Programming without an overall architecture or design in mind is like exploring a cave with only a flashlight: You don’t know where you’ve been, you don’t know where you’re going, and you don’t know quite where you are.Danny Thorpe

A stored procedure is a batch of SQL that’s stored permanently on the server and compiled when used. It’s not compiled in the sense of being translated to machine code or even Java byte codes—it’s pseudocompiled to speed execution. You create stored procedures using the Transact-SQL CREATE PROCEDURE command. All that really happens when you create a procedure is the insertion of its source code into the syscomments system table. The procedure isn’t compiled until it’s executed for ...

Get The Guru's Guide to Transact-SQL now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.