Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Searching by date with SQL Server

Status
Not open for further replies.

LucyP

Programmer
Jan 17, 2001
51
ES
I've been trying to retrieve files from a SQL server database (using ASP) having searched on a date field (generated by the database using GetDate). I know that SQL server should be able to convert a string to a date field with no problems, but I always get the error:

resulting date out of range.

I've tried various CONVERT procedures, as I think the problem may have something to do with my sql server using British date formats: I've tried converting the comparison string and the date field itself, British and American formats, but with no luck. Can anyone help?
 
Can you post your sql statement here and also the date format?

Thanks
 
You can also try to change the default date format of SQL server from the enterprise manager :

Rightclick on the server, select properties.
Select server settings. Change the default language for user to British english (dd/mm/yy).

SQL installs with 'English' as the default language which I assume is american (mm/dd/yy)
 
Thanks: it was the "English" setting in SQL server.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top