0

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.

2 Answers 2

1

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.

0

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .