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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

[22003][0][Microsoft][ODBC SQL Server Driver]Numeric value out of rang

Status
Not open for further replies.

luigiida

Programmer
Mar 26, 2003
29
0
0
IT
Hi,
I have a php application connected through odbc to a sqlserver database.
When I try to execute select queries on a smalldatetime table field I receive this message:

Warning: [22003][0][Microsoft][ODBC SQL Server Driver]Numeric value out of range


Any idea??
Thanks
Luigi
 
Can you post the query you are trying to execute?

--James
 
The query is something like:

select dateField from table

Tha field is a normal smalldatetime one:
10/17/2001 12:35:00 PM

Whith Query Analyzer the query works fine.
I'm using php mssql_query() and ODBTP as protocol to connect to the DBMS

Thanks
L
 
Try this:

SET DATEFORMAT MDY
SELECT DateField FROM table

If that doesn't work either, I would have to say the problem is with the php application not recognizing the datetime format. Why do I say that? You say the same query works in Query Analyzer, so that indicates to me that it's an issue with the application and not SQL Server.

-SQLBill

Posting advice: FAQ481-4875
 
BTW-check your php application to make sure that it will accept a datetime value as mm/dd/yyyy hh:mm:ss AM/PM.

With the error being "Numeric value out of range", it appears to me there is a conversion attempting to take place.

For example: It might be trying to put a SQL Server SMALLDATETIME value into a php application NUMERIC value column.

-SQLBill

Posting advice: FAQ481-4875
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top