November 12, 2006 at 3:19 am
Hi all,
When I execute my store procedure with
EXECUTE dbo.myStoreProcedure @myParameter = 'my date'
Its works, but If I want to make :
EXECUTE dbo.myStoreProcedure @myParameter = DATEADD(day, 2, getdate())
I have this message :
Msg 102, Level 15, State 1, Line 3
Syntaxe incorrecte vers 'day'.
degrem_m
Degremont
November 12, 2006 at 9:52 am
Try DATEADD(dd, 2, getdate()),
I cannot test, but often times passing a value to a parameter using a function fails.
you may need to do
declare @date datetime
set @date = DATEADD(dd, 2, getdate())
execute dbo.myprocedure @myParameter = @Date
November 13, 2006 at 7:20 am
DATEADD("day", 2, getdate()),
should work as well.
November 13, 2006 at 8:55 am
if you assign the value to date first:
ie..
@date = Getdate()
DATEADD(day,2,@date)
this should work.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply