What is the fastest way to log the Input and Output parameters when executing Stored Procedure
1
vote
2
answers
433
views
Normally i will log this information at the end of each SP. The syntax looks like this.
DECLARE @SPContent nvarchar(4000)= (
SELECT @ServiceID [ServiceID],
@AccountID [FID],
@AccountName [Username],
@TopupAmount [TopupAmount],
@TopupDesc [Description],
@TransID [ReferenceID],
@SourceID [SourceID],
@TopupIP [ClientIP],
@AccountBalance [FunBalance],
@ResponseStatus_Deduct [ResponseStatus],
@Now [FromTime]
FOR XML RAW)
INSERT INTO [dbo].[InputLogs]
([SPName]
,[SPContent]
,[CreatedTime]
,[Username])
SELECT 'SP_Balance_Deduct_Game',
@SPContent,
GETDATE(),
SUSER_NAME()
but i'm wondering if there is a optimal script to do this automatically where i only need to pass in the name of the SP as the only parameter
Asked by Tạ Đức
(11 rep)
Nov 4, 2022, 09:51 AM
Last activity: Jan 16, 2024, 12:06 PM
Last activity: Jan 16, 2024, 12:06 PM