I was receiving the same error on my find function because of my
conditions. I added this code to CAST int into VARCHAR. Maybe it'll help
someone,
$conditions['OR'] = array('NOT' =>
array(array('CAST('.$key.' AS VARCHAR)' => 'DataMapKeys.remote_key')));
$remote_count =
$this->DataMapDynDbo->find('count',array(
'fields' => array($key),
'conditions' => $conditions,
));
On Wednesday, November 14, 2012 5:03:41 PM UTC-5, Tomas wrote:
>
> Hi!!
> I work ussualy with mysql and I work in cake long time, but now with MS
> SQL, I get strange error on very simple thing - *view*, *index*,
> *edit*methods within
> *SCAFFOLD mode.*
> *
>
> Error: *SQLSTATE[22018]: [Microsoft][SQL Server Native Client 11.0][SQL
> Server]Conversion failed when converting the varchar value 'G12345' to data
> type int.
>
> There is a table called *'item'*, which has a field GLID - vachar(20).
> Simple field, not even primary key. the only thing is that it is in
> relation with other table 'material' with same properties. E.g. 'item'
> hasMany 'material' AND 'material' belongsTo 'item'.
>
> Can I link varchars as foreign keys in cake?? Because if I edit the field
> values and I remove letter 'G' ... 'G12345' >> '12345' then it works ok!!
> why cake converts something to int??
>
>
> Any idea?
>
> Thank you
> Tomas
>
--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.