ZF-7759: Some Mssql Number types fail to insert due to quotes

Issue Type: Bug Created: 2009-09-02T07:08:55.000+0000 Last Updated: 2012-11-20T20:53:22.000+0000 Status: Closed Fix version(s): Reporter: Chuck Reeves (creeves1982) Assignee: None Tags: - Zend_Db

Related issues: Attachments:


Mssql 2008 fails to insert using the insert method due to quotes. Mssql can convert Double and Int but throws an error for money and small money types.



<pre class="highlight">
CREATE TABLE dbo.testMoney
    id int NOT NULL IDENTITY (1, 1),
    paid money NOT NULL
    )  ON [PRIMARY]


<pre class="highlight">
class MoneyTable extends Zend_Db_Table_Abstract
 protected $_name = "testMoney";

$db = new MoneyTable;

$data = array('paid' => 5.25);

Query Created (taken from sql profiler)

<pre class="highlight">
INSERT INTO "testMoney" ("paid") VALUES ('5.25')

This causes Sql Server to fail since the 5.25 is in quotes. The query should be:

<pre class="highlight">
INSERT INTO "testMoney" ("paid") VALUES (5.25)


Posted by Ralph Schindler (ralph) on 2009-09-17T16:36:35.000+0000

What adapter & driver are you using?

Posted by Chuck Reeves (creeves1982) on 2009-10-05T09:04:35.000+0000

freedts on ubuntu. I adjusted the Zend_Db_Adapter_Pdo_Mssql and changed the _pdotype to be dblib.

Posted by Chuck Reeves (creeves1982) on 2009-12-18T11:58:15.000+0000

This appears to be an issue inside of MSSQL. I am still looking into what the issue with MSSQL to find out why this is failing. I actually found that on a table of mine with 4 money fields, it wanted me to CAST for only 1 out of those 4 fields.

Posted by Rob Allen (rob) on 2012-11-20T20:53:22.000+0000

Bulk change of all issues last updated before 1st January 2010 as "Won't Fix".

Feel free to re-open and provide a patch if you want to fix this issue.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.