I want this is auto proccess so that I am using getdate()-4 so please help me.
EXECUTE msdb.dbo.sysmail_delete_log_sp
@logged_before = GETDATE()-4 ;
GO
Error:
Msg 102, Level 15, State 1, Line 2 Incorrect syntax near ')'.
I want this is auto proccess so that I am using getdate()-4 so please help me.
EXECUTE msdb.dbo.sysmail_delete_log_sp
@logged_before = GETDATE()-4 ;
GO
Error:
Msg 102, Level 15, State 1, Line 2 Incorrect syntax near ')'.
From MSDN
You cannot specify a function name as a parameter default value or as the value passed to a parameter when executing a procedure
Try this way
DECLARE @tdy_date DATETIME = Getdate() - 4
EXECUTE msdb.dbo.Sysmail_delete_log_sp
@logged_before = @tdy_date