Link to home
Start Free TrialLog in
Avatar of actsoft
actsoftFlag for United States of America

asked on

Date_Add or Date_Sub

I am trying to add an expression to a BI container.
DATE_ADD(ARVLDATE,INTERVAL 2 DAY)
this continues to return an error of "incorrect syntax near '2'
screen shots attached
Avatar of James0628
James0628

I don't know if I can help, but FWIW:

 I don't see any screenshots, or anything else, attached to your post.

 You posted this in the MS SQL section.  Is DATE_ADD an MS SQL function?  It wasn't in the past, but maybe it's been added.  From a little searching I did, DATE_ADD seems to be a MySQL function, so maybe this should be in the MySQL zone?

 Apart from that, your syntax seems OK, so I don't know why you'd be getting an error.  I assume that ARVLDATE is a date or datetime column, and if it wasn't, I'd expect an error on that, not the 2.

 Any chance you're using MS SQL and actually using DATEADD, instead of DATE_ADD?  The DATEADD arguments would be:
 
DATEADD(day, 2, ARVLDATE)

 James
If  you are using mysql as James indicated, then the syntax you are using should work.

If however, you are using SQL Server, then date_add is not a valid sql server syntax.

dateAdd(day, 2, ARVLDATE)
ASKER CERTIFIED SOLUTION
Avatar of vdr1620
vdr1620
Flag of United States of America 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