Automating Code Creation
In the previous chapter, I gave you code that you can run to create a stored procedure that creates a stored procedure that inserts data into the table that you specify. The stored procedure in Listing 8.3 creates the code that can be run to create a stored procedure that updates any table that you pass in.
Code Listing 8.3. Creating an Update Procedure
CREATE PROC usp_create_update_proc @vchTable varchar(30), @vchKey varchar(30) AS SET NOCOUNT ON /* Declare the variable */ DECLARE @vchName varchar(30) DECLARE @intType int DECLARE @vchNameType varchar(255) DECLARE @vchPrint varchar(255) DECLARE @vchName2 varchar(30) DECLARE @vchNameType2 varchar(255) DECLARE @vchMessage varchar(255) DECLARE @intReturnVal int DECLARE ... |
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.