SELECT CONVERT(VARCHAR,GETDATE(),106)
Result: 26 พ.ค. 2008
If I want to select in english format, I must use command this
SET LANGUAGE us_english
SELECT CONVERT(VARCHAR,GETDATE(),106)
Result: 26 May 2008
SET LANGUAGE us_english
SELECT CONVERT(VARCHAR,GETDATE(),106)
SET LANGUAGE thai
SELECT CONVERT(VARCHAR,GETDATE(),106)
SELECT CONVERT(VARCHAR,GETDATE(),106)
SET LANGUAGE thai
SELECT CONVERT(VARCHAR,GETDATE(),106)
************************************************************
Case Study:
My problem, I created web application with ASP.NET and the application use datetime in format "dd-MMM-yyyy" for example "16-May-2008"(I set CultureInfo to "en-US" in Global.asax shown below).
void Application_BeginRequest(object sender, EventArgs e)
{
// Code that runs on application startup
System.Globalization.CultureInfo vNewCulture = new System.Globalization.CultureInfo("en-US");
System.Threading.Thread.CurrentThread.CurrentCulture = vNewCulture;
}
In test environment I connected the application to SQL Server database(in same IIS). The server set regional language to "en-US". When I query data from database, result is nomally.
Then I migrate database to real database server. In the real database server set regional to Thai "th-TH". When the application query data from database server, I founded error.
I fixed this problem by insert "SET LANGUAGE us_english" at the beginning of query data to all query.
************************************************************
http://mark-dot-net.blogspot.com
Amiable post and this enter helped me alot in my college assignement. Say thank you you seeking your information.
ReplyDelete