note 33117 added to function.mssql-query
| From: | j dot perry at oberthurcs dot com | Date: | Tue, 17 Jun 2003 09:00:59 +0000 |
| Subject: | note 33117 added to function.mssql-query | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-50469@lists.php.net to get a copy of this message | ||
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
----
Manual Page -- http://www.php.net/manual/en/function.mssql-query.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+33117
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+33117&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+33117&report=yes