0

I have a stored procedure with attributes like this:

CREATE PROCEDURE [sp_INUSAV_BASE](     
, @dUSAV_DAT DATETIME = NULL
, @dUSAV_DFR DATETIME = NULL
, @dUSAV_DTO DATETIME = NULL

I am trying to call this procedure from SSMS with:

exec sp_inusav_base @dUSAV_DAT = getdate()

Which is giving me error:

enter image description here

Why is that error? I've also tried to call like this:

exec sp_inusav_base  @dUSAV_DAT = (SELECT getdate())

But this is also giving me error:enter image description here

Why is that?

FrenkyB
  • 6,625
  • 14
  • 67
  • 114
  • 1
    Possible duplicate of [Incorrect syntax near ')' calling storedproc with GETDATE](https://stackoverflow.com/questions/2399104/incorrect-syntax-near-calling-storedproc-with-getdate) – Dan Jun 08 '17 at 05:46

1 Answers1

1

You can't use a function call as a parameter for a stored procedure. You need to assign getdate() to a variable first..

Duplicate of: Incorrect syntax near ')' calling storedproc with GETDATE

Dan
  • 231
  • 1
  • 12