3

how do one call a stored procedure that has date input .

spName getDate()

does not work.

the question is about calling within ms sql managment studio.

Martin Smith
  • 438,706
  • 87
  • 741
  • 845
none
  • 4,669
  • 14
  • 62
  • 102

1 Answers1

7

SQL Server 2008

declare @d date = getdate() /*Or datetime looking at the title*/
exec spName @d

Earlier Versions

declare @d datetime
set @d = getdate()
exec spName @d
Martin Smith
  • 438,706
  • 87
  • 741
  • 845
  • 3
    I've known for more than a decade that SQL Server procedures can't take functions as parameters, but I still try to do this every now and again. Because it _should_ work, damn it :) – Matt Gibson Oct 21 '10 at 09:53