The information in this article applies to:
SUMMARY
By default, the date format for SQL server is in U.S. date format MM/DD/YY,
unless a localized version of SQL Server has been installed. This setting
is fine for cases when an application that requires this functionality is
deployed in a manner guaranteeing that dates are used and inserted in the
same format across all platforms and locations where the application is
used.
MORE INFORMATION
If the date format is not taken into consideration by application
developers, a rare situation may arise where an application is inserting
dates into tables or using dates in WHERE clauses that are invalid. For
example, a given date like 20/05/97 will only be processed if the date
format is DD/MM/YY. However, a date like 12/05/97 will be processed with
both the DD/MM/YY and MM/DD/YY formats, possibly resulting in the wrong
date being used.
Use the SET Statement Per ConnectionSET DATEFIRST <number> Sets the first weekday to a number from 1 through 7. The U.S. English default is 7 (Sunday). SET DATEFORMAT <format> Sets the order of the date parts (month/day/year) for entering datetime or smalldatetime data. Valid parameters include mdy, dmy, ymd, ydm, myd, and dym. The U.S. English default is mdy. This method allows you use a date format for dates sent to SQL Server of d/m/y, but it is connection dependent. If a new connection is made to SQL Server or if the server is stopped and restarted, the date format goes back to m/d/y. Set the Language on the SQL ServerTo set the language on the server you must add a language by using sp_addlanguage. The example below sets the language for British English and gives the dates in DD/MM/YY format. The example can also be applied to other countries, but you may need to modify the parameters for sp_addlanguage.
To set the default language back to U.S. English after having installed another language, use the following SQL statements:
To check what default language a server has installed, use the following SQL command:
If the resulting value is 0, the default language U.S. English. If the result is not 0, run the following SQL command to find the installed default language setting and date format used:
SQL Server also supports multiple languages, by setting the language in SQL Server Setup. This requires the use of localization files that are available for most languages. For more information, please read the following article in the Microsoft Knowledge Base: Q169749 : INF: Installing Additional Languages on SQL Server Additional query words: mdy datetime Aust Australia instlang.sql US
Keywords : kbenv SSrvGen |
Last Reviewed: April 14, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |