PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: "Wechsler, Steven" <Steven dot Wechsler at mtvstaff dot com>
Subject: RE: Odd issue with DBI/DBD::Sybase
Date: Feb 11 2008 10:18PM

But why would this have worked previously? And I also tried
$dbh->bind_col(1, $value, {TYPE => SQL_NUMERIC } ), but I still got the
error.


Steve Wechsler | steven.wechsler@mtvstaff.com 
Sybase/SQL Server/MySQL Database Administrator 
212-846-5683 

MTV Networks 

 

________________________________

From: Jason L. Froebe [mailto:jason@froebe.net] 
Sent: Monday, February 11, 2008 5:14 PM
To: Wechsler, Steven; sybperl-l@peppler.org
Subject: Re: Odd issue with DBI/DBD::Sybase


The query after the placeholder value is transformed:

select  UserID, AttributeID, Rank from
nick_user_profile..up_UserAttribute  where UserID = "64152205"

try:

select  UserID, AttributeID, Rank from
nick_user_profile..up_UserAttribute  where UserID =
convert(numeric(8,0), ?)

 
Jason L. Froebe 
 
WebBlog http://jfroebe.livejournal.com
Tech log http://www.froebe.net/blog
Froebe Fibers http://www.froebe-fibers.com 


----- Original Message ----
From: "Wechsler, Steven" 
To: sybperl-l@peppler.org
Sent: Monday, February 11, 2008 3:10:08 PM
Subject: Odd issue with DBI/DBD::Sybase



I'm getting this error: 

Unable to retrieve key from seclivesyb02 for 64152205: Implicit
conversion from datatype 'VARCHAR' to 'NUMERIC' is not allowed.  Use the
CONVERT function to run this query.

Here's the prepare statement: 

$data_sth{$server} = $handles{$server}->prepare($sql_template); 

Here's the SQL I'm preparing: 

select  UserID, AttributeID, Rank from
nick_user_profile..up_UserAttribute  where UserID = ? 

Here's the execute statement: 

    $data_sth{$server}->execute(@$row); 

@$row is a list with a single value: 64152205 

And here is the table schema: 

CREATE TABLE dbo.up_UserAttribute
(
    UserID      numeric(8,0) NOT NULL,
    AttributeID smallint     NOT NULL,
    Rank        smallint     NOT NULL,
    IntValue    numeric(8,0) NULL,
    TextCopy    varchar(255) NULL,
    StateID     tinyint      NOT NULL,
    TargetID    numeric(8,0) NULL,
    Title       varchar(255) NULL,
    Link        varchar(255) NULL,
    CONSTRAINT pk_UserAttribute
    PRIMARY KEY CLUSTERED (UserID,AttributeID,Rank)
) 

Now, the really odd thing is that this script worked fine until
recently, when apparently SOMETHING (I'm not sure what) changed, and now
I cannot do any input parameter binding on any table; it always results
in this error.  Any ideas?

Thanks. 



Steve Wechsler | steven.wechsler@mtvstaff.com 
Sybase/SQL Server/MySQL Database Administrator 
212-846-5683 

MTV Networks