
October 8th, 2009, 05:44 PM
|
|
Registered User
|
|
Join Date: Oct 2009
Posts: 1
Time spent in forums: 7 m 7 sec
Reputation Power: 0
|
|
Stored Procedures - How to insert code into every stored procedure in a database
Hi, I'm working with SQL Server 2008 and now I need to insert 3 lines code into the beginning of every stored procedure in database. (The purpose to do this is to track execution history) There are about 3000 stored procedures so definitely I dont wanna do it manually. Here is an example about how I wanna the sp looks like:
ALTER PROCEDURE [dbo].[StoredProcudureSample] @variable int
AS
SET NOCOUNT ON
DECLARE @ProcName VARCHAR(200)
SET @ProcName = OBJECT_NAME(@@PROCID)
EXEC [dbo].[Sproc_SaveStoredProcedureExecute] @StoredProcedureName = @ProcName
--original stored procedure body
...
Does anyone have good idea about this?
TIA,
Julie
|