getdate() problem

  • I have a user defined function which has 2 parameters func_x (@A datetime, @b-2 int)

    When i give a call as select func_x(Getdate(), 1)- it gives me an error 'Incorrect syntax near Getdate'

    I am running in query analyzer-any ideas?

  • Pass your date in as a variable:

    declare @mydate datetime

    set @mydate = getdate()

    select func_x(@mydate ,1)

    Iain

  • Iain has the idea. The call doesn't want a function as a parameter. You need to assign it first.

    Seems silly to me, but probably some technical reason that doesn't seem worth fixing.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply