dbTalk Databases Forums  

"Invalid character value for cast specification" in DTS Lookup

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


Discuss "Invalid character value for cast specification" in DTS Lookup in the microsoft.public.sqlserver.dts forum.



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

Default "Invalid character value for cast specification" in DTS Lookup - 01-19-2006 , 01:35 PM






Hi Folks,

I have a DTS ActiveX script (VB) which calls a lookup requiring three numeric
parameters and returns a single character value.
It consistently throws up "Invalid character value for cast specification".

I have tested the lookup both in the lookup definition dialogue and by
passing numeric literals in the script. (I passed values that I knew should
return a value - and it did).
I have tried using CDbl & CLng on the variables passed.
I can see (by omitting the lookup line from the code) that the parameters are
valid values.

Is there any way of determining what is happening to the passed parameters?
Why is DTS trying to cast them when they are already defined as numeric?
Am I doing something silly?

Code attached.

Thanks,

Owen.

***********ActiveX Code starts here***************
Function Main()
varCUSTNO=clng(Mid(DTSSource("CUST11"), 5, 7))
varDLVYPT=clng(Mid(DTSSource("CUST11"), 12, 5))
varDATE11=clng(DTSSource("DATE11"))
DTSDestination("CUSTNO") = varCUSTNO
DTSDestination("DLVYPT") = varDLVYPT
DTSDestination("AccountGrade") = DTSLookups("GetGrade").Execute(varCUSTNO,
varDLVYPT, varDATE11)
Main = DTSTransformStat_OK
End Function

***********Lookup SQL starts here***************
SELECT TOP 1 YEGRD
FROM YCGRDHP
WHERE (YECST = ?) AND (YEDTN = ?) AND (YEFDT <= ?)

***********Create statement for the table accessed by lookup***************
CREATE TABLE [dbo].[YCGRDHP] (
[YECST] [decimal](7, 0) NOT NULL ,
[YEDTN] [decimal](5, 0) NOT NULL ,
[YEGRD] [char] (2) NOT NULL ,
[YEFDT] [decimal](7, 0) NOT NULL
) ON [PRIMARY]

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.