dbTalk Databases Forums  

ActiveX Problem

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss ActiveX Problem in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Rafael
 
Posts: n/a

Default ActiveX Problem - 12-15-2003 , 01:21 PM






I'm new to DTS. I have the following problem: Im trying to update a record with an Data Driven query, but each time i execute it, the following error ocurrs.

"Syntax error converting the varchar value 'Main producer' to a column of data type smallint.

the query is:

UPDATE dbo.DistributionChannel
SET Descript = ?
WHERE (DistributionChannel = ?)

and the activex scipt is
Function Main()
DTSDestination("DistributionChannel") = (DTSSource("nIntertyp"))
DTSDestination("Descript") = DTSSource("sDescript")
IF IsEmpty (DTSLookups("BuscarDistChan").Execute(DTSSource("n Intertyp"))) THEN
Main = DTSTransformStat_InsertQuery
ELSE
Main = DTSTransformStat_UpdateQuery
END IF
End Function

Distributionchannel and nIntertyp are Smallint,
Descript and sDescript are vharchar(30)

Can anyone please tell me why this error is ocurring or what im doing wrong ???

Tks.
Rafa

Reply With Quote
  #2  
Old   
Darren Green
 
Posts: n/a

Default Re: ActiveX Problem - 12-15-2003 , 02:58 PM






In article <5360CDF0-ED9C-44AC-AB03-15A24300B300 (AT) microsoft (DOT) com>, Rafael
<anonymous (AT) discussions (DOT) microsoft.com> writes
Quote:
I'm new to DTS. I have the following problem: Im trying to update a record
with an Data Driven query, but each time i execute it, the following error
ocurrs.

"Syntax error converting the varchar value 'Main producer' to a column of
data type smallint.

the query is:

UPDATE dbo.DistributionChannel
SET Descript = ?
WHERE (DistributionChannel = ?)
and the activex scipt is
Function Main()
DTSDestination("DistributionChannel") =
(DTSSource("nIntertyp"))
DTSDestination("Descript") = DTSSource("sDescript")
IF IsEmpty (DTSLookups("BuscarDistChan").Execute(DTSSource(
"nIntertyp"))) THEN
Main = DTSTransformStat_InsertQuery
ELSE
Main = DTSTransformStat_UpdateQuery
END IF
End Function

Distributionchannel and nIntertyp are Smallint,
Descript and sDescript are vharchar(30)

Can anyone please tell me why this error is ocurring or what im doing
wrong ???

Tks.
Rafa

The error makes me think that you have got the two values the wrong way
round as I assume 'Main producer' is a description, and obviously it is
trying to convert it to the same type as the small int.

Double check the parameter mapping for both the insert and update
queries. Are you sure it is not the insert query that is raising the
error?

Are the input columns labelled badly, or do you perhaps have a badly
formatted files such that there really is text data in what should be a
int column, or even the file is corrupt such that it misreads the
values?
--
Darren Green (SQL Server MVP)
DTS - http://www.sqldts.com

PASS - the definitive, global community for SQL Server professionals
http://www.sqlpass.org



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.