asked on
SELECT
p.name AS Parameter,
t.name AS [Type]
FROM sys.procedures sp
JOIN sys.parameters p
ON sp.object_id = p.object_id
JOIN sys.types t
ON p.system_type_id = t.system_type_id
WHERE sp.name = 'Insert_Order'
BEGIN CATCH
DECLARE @ErrorMessage NVARCHAR(4000);
DECLARE @ErrorSeverity INT;
DECLARE @ErrorState INT;
DECLARE @ObjectName NVARCHAR(100);
SELECT
@ErrorMessage = ERROR_MESSAGE(),
@ErrorSeverity = ERROR_SEVERITY(),
@ErrorState = ERROR_STATE(),
@ObjectName = OBJECT_NAME(@@PROCID); -- To get the current object name which raise the error
RAISERROR(@ErrorMessage,@ErrorSeverity,@ErrorState);
ROLLBACK TRANSACTION
--Log the Error
EXEC dbo.spLog_Application_Error 'SYSTEM', @ErrorMessage, @ErrorSeverity, @ErrorState, @ObjectName --Added by Adriano
SELECT -1
END CATCH
ASKER
ASKER
Microsoft SQL Server is a suite of relational database management system (RDBMS) products providing multi-user database access functionality.SQL Server is available in multiple versions, typically identified by release year, and versions are subdivided into editions to distinguish between product functionality. Component services include integration (SSIS), reporting (SSRS), analysis (SSAS), data quality, master data, T-SQL and performance tuning.
TRUSTED BY
Atleast as far as I know.
In one of my projects, we pass the parameters of the stored procedure concatenated with thier names or seperated by commas to the error handling stored proc.
Or put them into the log table manually in the catch block...
Unfortunately I think there is no other way.