I don’t think it is possible to do so what I would but I ask anyway.
I’ve found that I include the same variables in the top of every Stored Proc I make.
These variables are used for logging and error handling. They don’t change between stored procs, there meaning if fixed but primary use is to help readability and have a consistent style.
-- Declare code that resolve to possible Error
DECLARE @CONFLICT_CODE AS INT
SET @CONFLICT_CODE= -99
-- Check for Conflict
IF Found > 0
BEGIN
SELECT @Error = @CONFLICT_CODE
END
I would be great to define these in a file that I could include into the stored proc.
I’m developing on SQL Server 2008 deploying to SQL Server 2005
You can’t do this in TSQL. Another way, there is no include or macro feature
However, you could create a UDF thus:
This would replace this in every proc
and you’d use this