note 33117 deleted from function.mssql-query by sniper
| From: | sniper@php.net | Date: | Mon, 17 Nov 2003 22:59:55 +0000 |
| Subject: | note 33117 deleted from function.mssql-query by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-60543@lists.php.net to get a copy of this message | ||
Note Submitter: j.perry@oberthurcs.com
----
PHP 4.3.2 on IIS4 connecting to MSSQL 2000 - mssql_query
You may have problems returning fields that are of a 'decimal' type. I wanted to pull
through the quantity, unitcost and totalcost fields. These three fields are 'decimal'
with a scale of 20. PHP pulled through the value with 20 Decimal Places. I don't know if
it's a memory space issue or what the reason, but the query would start and just hang,
eventually timing out. I had to pull through these decimal fields by casting them to
'float' values.
Instead of....
"SELECT ......
[Quantity], [UnitOfMeasure], [UnitCost], [Total] ....."
....I used......
"SELECT ......
CAST([Quantity] as Float) as Qty, [UnitOfMeasure],
CAST([UnitCost] as Float) as UCost,
CAST([Total] as Float) as TCost ....."
Oh the joy! I wasted 2 weeks trying to figure out why this problem occurred. Hopefully,
you'll all find this useful.
JP