Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 SQL server 2000 does not like the single quote

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-05-25 : 08:55:50
zilman writes "I am using VB in ASP.NET to develop a web application. The SQL server 2000 does not take in the date values as presented in a query string. If a date value of say '12/10/2005' is passed, it converts it to '10/12/2005'. In order to isolate the cause of error I tried to run simple 'SELECT' queries from Enterprise manager. When I run the query from the query analyser delimiting the the date literal with single quotes, it converted them in identical fashion to the one mentioned above in relation to query strings in VB. I then changed the single quotes to double quotes and run the statement again. This time it executed perfectly.

I run this test on another SQL-SERVER 2000 installed on a different machine, but the statements with single quotes run smoothly without any hiccups and I am convinced that this is something to do with how the SQL server 2000 is set up on the machine. I would be grateful if you can help me to correct the set up without reinstalling the whole thing again.

If this may not be possible, your help to overcome the syntactic difficulties of incorporating double quotes within double quotes in a query string would also be equally helpful.

Many thanks

Zilman"

mr_mist
Grunnio

1870 Posts

Posted - 2006-05-25 : 09:33:27
One of the servers probably has UK / US date settings as its locale, depending on whatever the other has. If you pass dates as YYYYMMDD you should be able to avoid that kind of mess.

-------
Moo. :)
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-05-25 : 09:38:34
Always use Universal format YYYYMMDD or YYYY-MM-DD
Also read this
http://www.sql-server-performance.com/fk_datetime.asp

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -