Link to home
Start Free TrialLog in
Avatar of mcrmg
mcrmg

asked on

Passing parameters

Hi,

I have a sp that takes two dates as parameters.  When I run it using two dates, exec my-sp '1/29/2018', '1/29/2018', it runs fine. But when I use this

Exec my-sp DATEADD(day, DATEDIFF(day,0,GETDATE())-1,0),DATEADD(day, DATEDIFF(day,0,GETDATE())-1,0)

it shows the error

Incorrect syntax near 'day'.

I am not sure where the problem is. thanks
ASKER CERTIFIED SOLUTION
Avatar of ste5an
ste5an
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mcrmg
mcrmg

ASKER

thank you. I will assign it to a variable first.