March 7, 2006 at 9:32 am
I'm trying to execute this simple string: INSERT INTO tblLog (Data) VALUES ('03/15/06')
I'm using an online provider on SQL Server, and it works properly. When I execute the same Query on my Server (Running Windows 2003 Server Italian Edition and SQL Server) it generates an error about date format. How can I make my SQL Server work as provider one?
March 7, 2006 at 9:49 am
Hello Enrico,
Can you check up the default date format for your Windows OS? It might be of the format "dd-mm-yy".
Thanks and have a nice day!!!
Lucky
March 7, 2006 at 9:54 am
My OS date setting is dd-mm-yy, 'coz it's italian. But I read that SQL Server can be set using differente date format, like english format without changing OS date system. How can i do?
March 7, 2006 at 10:18 am
Add this to the beginning of your script:
SET DATEFORMAT MDY
The issue is that SQL Server doesn't know if 3/15/06 means March 15, 2006 or the 3rd day of the 15th month in 2006 (which doesn't exist).
SET DATEFORMAT tells SQL Server how to interpret date formats when they are inputted.
-SQLBill
March 8, 2006 at 3:30 am
If you use dd-MMM-yyyy you can use this irrespective of the date format. EG. 15-MAR-2006. And it can be read correctly by anyone.
March 8, 2006 at 6:51 am
Check the language for the login and for the server (Default Language) as this affects the way dates are converted.
If possible use yyyymmdd format or SET DATEFORMAT as already mentioned.
Far away is close at hand in the images of elsewhere.
Anon.
March 8, 2006 at 6:59 am
I get access to the SQL Server with a ASP page, this is the connection string: strConnect = "Driver={SQL Server};Server=server;Database=Main;Uid=xxxxx;Pwd=xxxx;"
Is there a way to specify the language in the connection string?
Thank you.
March 8, 2006 at 8:16 am
Add Language=x to the connection string where x is the sql language e.g.
Italian is dd/mm/yyyy
English is mm/dd/yyyy
British English is dd/mm/yyyy
Far away is close at hand in the images of elsewhere.
Anon.
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply