"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] |