Content of the Custom Stored Procedure sp_I_Uom_Log
- Last UpdatedMay 17, 2023
- 1 minute read
CREATE PROCEDURE sp_I_Uom_Log
(@description nvarchar(40)
,@abbreviation nvarchar(20)
,@last_edit_comment nvarchar(254)
,@my_arg nvarchar(40) = null
,@last_edit_at datetime OUT
,@uom_id int OUT
) AS
BEGIN
SET NOCOUNT ON
DECLARE @logged_at DATETIME
--Call other SPs if needed.
SET @logged_at = GETDATE()
INSERT INTO error_log (logged_at, severity, instance_info
, object_name, object_section, description, system_msg)
VALUES (@logged_at, 0, @abbreviation
, @description, @description, @description, @description)
SET @uom_id = SCOPE_IDENTITY()
--Call other SPs if needed.
END
As can be seen from its content, the stored procedure sp_I_Uom_Log contains all the parameters and their properties that sp_I_Uom has, and an additional parameter containing more contextual information. This additional parameter has a NULL default value as it will not be provided any value when called from the MES middleware as a pre-hook. The custom stored procedure can completely ignore the input parameters and the code inside the "begin and end" block can be customized for individual needs. The statements in bold indicate that one or more custom stored procedures can be called from this custom stored procedure. The concept described above is also applicable to configuring the post-hook of type stored procedure.