question

csb avatar image
csb asked

Dates in SQL 2008 backend and Access Frontend

I am migrating data from Access to SQL Server 2008 and keeping for now the Access frontend. I'm finding that dates in the Access frontend are now showing as YYYY/MM/DD rather than the reverse. I'm assuming its because the SQK Server backend is english language and the dates are stored that way. Anyway, is there any way to change this on the SQL backend without changing the Access frontend ? CSB
sql-server-2008datetimeaccessdateformat
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Grant Fritchey avatar image
Grant Fritchey answered
You can use the command SET DATEFORMAT to make that happen. Here is the relevant [Books Online entry][1]. [1]: http://msdn.microsoft.com/en-us/library/ms189491.aspx
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

WilliamD avatar image
WilliamD answered
Another option would be to use [CONVERT][1] in the select statement/view that is accessing the data: SELECT GETDATE(), -- 2011-02-08 08:55:36.803 CONVERT(varchar(100), GETDATE(), 101),-- 02/08/2011 CONVERT(varchar(100), GETDATE(), 102),-- 2011.02.08 CONVERT(varchar(100), GETDATE(), 103),-- 08/02/2011 CONVERT(varchar(100), GETDATE(), 0) -- Feb 8 2011 8:55AM [1]: http://msdn.microsoft.com/en-us/library/aa226054(SQL.80).aspx
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

csb avatar image
csb answered
Actually the best answer to this question is that when using the SSMA Migration aid (as I am doing and failed to mention above) you need to specify DateTime for Access Date field conversions in the data mapping section. If you use date or datetime2 or any other data mapping the date fields come over to sql as dates but appear to Access as text. That's why they are formatted YYYY/MM/DD rather than the reverse as they were in Access frontend and backend. They are not only backwards but can't be used in date calculations as well. SSMA is a great migration tool but there are some differences to note on the default field type mappings.
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.