freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
Re: [freetds] 'Money' column types need an explicit convert
- From: "James K. Lowden" <jklowden AT freetds.org>
- To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
- Subject: Re: [freetds] 'Money' column types need an explicit convert
- Date: Mon, 14 Aug 2006 21:16:19 -0400
Daniel Kasak wrote:
> DBD::ODBC::db prepare failed: [unixODBC][FreeTDS][SQL
> Server]Statement(s) could not be prepared. (SQL-42000)
> [unixODBC][FreeTDS][SQL Server]Disallowed implicit conversion from data
> type varchar to data type money, table 'NUSsql.dbo.Clients', column
> 'DisputeAmount'. Use the CONVERT function to run this query.
> (SQL-42000)(DBD: st_prepare/SQLPrepare err=-1) at
> .client_services/modules/common.pm line 108
>
> I can deal with the problem - I'll either convert the column to
> something other than money, or add a covert() function if I detect a
> 'money' column type. Anyway, the question is: is this a bug or a
> feature?
I think that's a server message. Try this query:
select cast(1 as money) as 'a' union select '2'
You should get:
Msg 257, Level 16, State 3
Implicit conversion from data type varchar to money is not allowed. Use
the
CONVERT function to run this query.
(The character value '2' is implicitly converted to the datatype (money)
established by the first part of the UNION.)
You said it's a "simple update" statement, indicating that somewhere
you're pointing quotes around a numeric value or storing a number in a
variable declared as char/varchar. Stop doing that and you'll be OK. ;-)
If you're binding to a character host variable, similar restrictions
apply.
HTH.
--jkl
-
[freetds] 'Money' column types need an explicit convert,
Daniel Kasak, 08/14/2006
-
Re: [freetds] 'Money' column types need an explicit convert,
James K. Lowden, 08/14/2006
-
Re: [freetds] 'Money' column types need an explicit convert,
Daniel Kasak, 08/14/2006
- Re: [freetds] 'Money' column types need an explicit convert, James K. Lowden, 08/14/2006
-
Re: [freetds] 'Money' column types need an explicit convert,
Daniel Kasak, 08/14/2006
-
Re: [freetds] 'Money' column types need an explicit convert,
James K. Lowden, 08/14/2006
Archive powered by MHonArc 2.6.24.