Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to set the default date format per server instance, but i only find examples that set the date format per session. It's is possible to do the former through T-SQL?

Thanks in advance.

share|improve this question

2 Answers 2

What you ask for can not be done becuase a default date does not exist. Dates are not stored as strings, but as number (nr days from a starting point in time). EVERY string format is ALWAYS depending on the session as it is always formatted as the user asking for it wants.

If you really need to put in dates as strings, use ISO form, which is accepted under all locales. It has the form YYYY-MM-DD (like 2010-09-29).

But all dates returned are always returned actually AS date fields and the string form is only generated on the client.

share|improve this answer
up vote 0 down vote accepted

To change the date format per server instance, you need to change the default language of the server. This can be done through SQL Server Management Studio by right clicking on the server node then properties -> advanced -> default language. Be aware that logins created prior this change will use the old default laguage. To change the default language for each login:

sp_defaultlanguage 'login_name', 'language_name'

For my case I used the language 'brazilian', in wich the default date format is DMY.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.