HiWithin a stored procedure, is there a way to add a directive which wraps around a piece of code, thereby that code is only visible if its directive is TRUE?For example, in DEBUG mode, have code wrapped within a TRY/CATCH block: Declare @deadline intset @deadline = 0BEGIN TRY SELECT DaysToManufacture / @deadline from AdventureWorks.Production.Product WHERE ProductID = 921END TRYBEGIN CATCH EXECUTE usp_GetErrorInfo;END CATCH;
And in PRODUCTION mode for performance reasons, have TRY/CATCH block not visible to the SQL engine. For exampleDeclare @deadline intset @deadline = 0SELECT DaysToManufacture / @deadlinefrom AdventureWorks.Production.ProductWHERE ProductID = 921 SELECT usp_GetErrorInfo;
Ideas?ThanksJeff in Seattle