Error with DATE2DMY (Date) in SQL

ntnt Member Posts: 160
hi,
i used the DATE2DMY (Date) function in the navision. now o pass the DB to SQL and i start to get error (invalid date) in this function when the date is empty.
anyone can a way to turn around?

thanks

Comments

  • krikikriki Member, Moderator Posts: 9,118
    I think it is rather that you give a date that is not accepted by SQL.
    Check this post : http://www.mibuso.com/forum/viewtopic.php?p=41073#41073

    So when you want to give the year 2006 to the function, you must give "2006" and not "06".
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • ntnt Member Posts: 160
    i don't have the problem with dates. my problem is when i'm inserting a new record in a table in some point i got that function in the code, and the date is empty (and the date should be empty). with the navision db i dont get any error, with the sql db i get that error (invalid date).
  • kinekine Member Posts: 12,562
    The behavior on MS SQL are different in some areas. It seems, that this is one of them. Use condition to precede this error...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • krikikriki Member, Moderator Posts: 9,118
    Which was the statement? :shock:
    I tried
    MESSAGE('<%1>',DATE2DMY(0d,3));
    
    On both SQL (3.70A) and Native (3.60) and in both cases I got an error (=The date is not valid).
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.