Excel keeps displaysing a number instead of date in SQL UPDATE statement

Need to update a date field in Excel using a SQL update statement but Excel displays it as a number in my statement.

Ex.  UPDATE WO_OPERATION SET CLOSE_DATE = '42101' WHERE SI_NUMBER = '5016310';
when the date is 7-Apr-15.

Screenshot attached. Any help will be greatly appreciated.
Capture.PNG
maximus1974Asked:
Who is Participating?
 
KoenChange and Transition ManagerCommented:
try putting the date in as follows: text (cn2, "dd-mmm-yy")
0
 
Wayne Taylor (webtubbs)Commented:
Dates are stored as numbers in Excel, which is why it is appearing as it is. To force the date format, you need to use the TEXT function...

="UPDATE WO_OPERATION SET CLOSE_DATE = '"&TEXT(CN2, "d-mmm-yy")&"' WHERE SI_NUMBER = '"&B2&"';
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.