0

I have migrated an Access database to SQL server. Many of my "dates" were stored in the Access database in the format "DD/MM/YYYY". However, I notice the SSMA has updated all date columns to the format "DD-MM-YYYY HH:MM:SS". What type should we choose in SQL Server to accomplish the same? The thing that is I want to keep it this way as else we need to change the underlying code.

Much appreciated for your help!

2 Answers 2

1

According to this http://social.msdn.microsoft.com/Forums/en-US/4920b4f5-6855-4855-96a9-43f9365d63a0/change-sql-server-date-format the format SQL Server stores datetime fields is generic. You can convert the datetime fields and convert it to varchar in order to show the formal you want. For example this

convert(varchar, datimefield, 103)

will convert the datetime field using the format 'dd/mm/yyyy'

Sign up to request clarification or add additional context in comments.

1 Comment

This means I would need to rewrite all of my queries, correct?
0

You should be able to use the date datatype to not store the time, as according to This Link, but only in 2008 or 2012

I checked if it works as such on my SQL Server 2008, and it does.

This will still show it with a dash rather then a slash and in the order YYYY-MM-DD though.

2 Comments

Thanks for the inputs, but this is not what I'm looking for!
@KrisVandenBergh That's fine, I'll leave it here in case it helps someone else. Good luck with re-writing your queries.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.