Dateformats in SQL.

Status
Not open for further replies.

Luhman

Ars Scholae Palatinae
846
I've converted an access database to SQL 2014 (express). One of the little issues is that it switched the date formats from mm/dd/yyyy to yyyy-mm-dd. Is there a way to force the mm/dd/yyyy format in the access database?

Or switch the date output on the sql server?

I can see how to do it per session, but how can I avoid date conversion issues with the staff that use this db?

Edit, I figured out that if you use the date column format, then access reads it as text. If you use datetime, then access uses a date format at formats to the mm/dd/yyyy standard. either way, you have to refresh the linked tables to get the right view after the conversion.
 

Luhman

Ars Scholae Palatinae
846
It turned out that if you have it stored at Date, then access links the field as Text once you refresh the tables. If you use Datetime, then access uses Date/Time and you can use formatting on the linked tables to get the format you need. The problem was that the formatting on the datetime wasnt working at first. The trick was refreshing the linked tables after conversion.

As a sample, here is a snippet of what I observed. This is condensed and it took me hours of testing before I twigged to what was happening.

Access Date/Time: 01/01/2015
After Conversion
SQL DateTime Displayed as 01/01/2015 00:00:00 (Access Formatting not applied)

Change SQL Schema to DATE
SQL Date Displayed as 01/01/2015 (Looks Right)

Refresh linked table due to unrelated schema change
SQL Date Displayed as 2015-01-01 (uhoh what happened to my dates)

Go back to Date Time
Refresh Linked Table
SQL DateTime Displayed as 2015-01-01 (uhg, how do I get back).

Reconvert
Access Date/Time: 01/01/2015
Refresh Linked table
SQL DateTime Displayed as 01/01/2015 (Access formatting applies. this is just what I needed without additional mucking about.)
 
Status
Not open for further replies.