How SQL Server Creates Stored Procedures

Unfortunately, despite the title of this section, SQL Server doesn't create stored procedures for you. You have to plan out how the stored procedure will work, write the code, and then debug the code. Nevertheless, when you finally have your code written and execute the CREATE PROCEDURE statement, SQL Server has to go through a couple of steps before the code is actually created as a stored procedure.

Prior to SQL Server 7.0, when you executed the CREATE PROCEDURE statement, SQL Server would parse the statement, resolve the names of all objects referenced in the procedure, and partially compile the stored procedure. The precompiled statement was stored until the procedure was executed. This saved compilation ...

Get Writing Stored Procedures for Microsoft SQL Server 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.