If I run this query on SQL Server Express 2008 :
Insert NoteBook (Date, Note) Values ('11/04/2011 11:02:46', 'test')
It stored the date as 04/11/2011
How can I prevent this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Use the ISO-8601 format:
YYYYMMDD(orYYYY-MM-DDTHH:MM:SS) – it works always, regardless of your SQL Server language and locale settings.The date in SQL Server is NOT stored in any particular string-oriented format – a date is a date is a date, regardless of what you see.
You see a string representation of the date – but again: it’s NOT stored that way – and thus you cannot “prevent” it from being stored that way…
Check your language settings in SQL Server:
What language do you have?? The language defines the default format in which dates are shown.