Have you tried putting the appropriate money symbol in the front of the string ? Such as $ for US currency.

HTH,

Chuck

[EMAIL PROTECTED] wrote:

Hi all.

I'm using the process:

my $sth = $dbh->prepare ( "update xxx set a=?, b=?, c=? where d=?" );
$sth->execute( $a, $b, $c, $d );

to update data in a SQL Server database. It works fine most of the time,
but if I have a 'money' column type in SQL Server, I get the following
error:

[unixODBC][FreeTDS][SQL Server]Disallowed implicit conversion from data
type varchar to data type money, table 'NUSsql.dbo.EAPosting', column
'EAPTotal'. Use the CONVERT function to run this query. (SQL-)

I've googled around and found that this error occurs if you enclose a
money value in single quotes. There are a couple of problems with this.

Firstly, I'm not quoting the values ... I assume something further up
the chain is. Possibly DBD::ODBC or FreeTDS?
Secondly, I've got a couple of layers of abstraction between getting the
data, processing it, and updating the database, and I really can't (
without some *major* work ) insert convert() functions around things -
particularly since a lot of the stuff I'm doing is supposed to be
db-neutral.

I suppose I can convert the data in SQL Server to something else. I
didn't set the table up - I wouldn't have used 'money' anyway, but I'm
not sure what effect changing it now will have.

Anyone encountered this before? Looks like a bug to me.

Reply via email to