0

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 ')'.

diiN__________
  • 7,393
  • 6
  • 42
  • 69
Rushang
  • 165
  • 2
  • 2
  • 8

1 Answers1

2

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 
Pரதீப்
  • 91,748
  • 19
  • 131
  • 172