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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 SQL Server date problem

Author  Topic 

km11022211
Starting Member

1 Post

Posted - 2007-08-24 : 04:34:43
Hi

There is an web based application which when submitting a query to the backend SQL Server, with date in the format of dd/mm/yyyy, the same is being interpreted as mm/dd/yyyy. The SQL Server throws an data type conversion error whenever the 'dd' part exceeds 12 as it is interpreted as invalid 'month' by the server (all the dd, mm and yyyy parts are supplied from the front end and concatenated as dd/mm/yyyy before being submitted to the server). Even the Query Analyzer throws the same error. I have changed the date format to 'dmy' (was 'mdy' previously) and the query did work through query analyzer...but the application still fails.

Strangely, the production version, with a date format set to 'mdy' runs without a single issue.

The @@language yields 'us english' in both.


Any idea please?

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-08-24 : 05:40:42
1 Always use parameter of DATETIME datatype
2 Express date values in YYYYMMDD HH:MM:SS format

Madhivanan

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

- Advertisement -