dbTalk Databases Forums  

microsoft ole db provider for sql server invalid character value for cast specification

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


Discuss microsoft ole db provider for sql server invalid character value for cast specification in the microsoft.public.sqlserver.dts forum.



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

Default microsoft ole db provider for sql server invalid character value for cast specification - 03-05-2005 , 03:31 PM






I am using a simple lookup liske this :

SELECT COUNT(USERID) AS countID
FROM dbo.user
WHERE (IS_ACTIVE = 'Y') AND (USERID= ?)

USERID =(numeric(3,0),not null)

and I am trying to send it the value through my activex code as this

IF DTSSource("Col002").Value <> "P1" AND IsNumeric(
DTSSource("Col002").Value ) THEN
IF DTSLookups("UserLookup").Execute(DTSSource("Col002 ").Value) > 0 THEN
Validation =TRUE
END IF
end if
but I'm getting this error:

microsoft ole db provider for sql server invalid character value for cast
specification


Thanks for your help






Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: microsoft ole db provider for sql server invalid character value for cast specification - 03-06-2005 , 03:30 AM






Have a look at all the values for Col002

Do this in QA

select ISNUMERIC('£')

It returns a 1 whereas this is most definitely not a number.

Allan

"RayAll" <RayAll (AT) microsft (DOT) com> wrote


Quote:
I am using a simple lookup liske this :

SELECT COUNT(USERID) AS countID
FROM dbo.user
WHERE (IS_ACTIVE = 'Y') AND (USERID= ?)

USERID =(numeric(3,0),not null)

and I am trying to send it the value through my activex code as this

IF DTSSource("Col002").Value <> "P1" AND IsNumeric(
DTSSource("Col002").Value ) THEN
IF DTSLookups("UserLookup").Execute(DTSSource("Col002 ").Value) > 0 THEN
Validation =TRUE
END IF
end if
but I'm getting this error:

microsoft ole db provider for sql server invalid character value for cast
specification


Thanks for your help


Reply With Quote
  #3  
Old   
RayAll
 
Posts: n/a

Default Re: microsoft ole db provider for sql server invalid character value for cast specification - 03-06-2005 , 01:58 PM



Allan,

The problem was that in Destination Table,it was defined to be numeric with
precision 3 and I had a number with 10 digits in my source CSV file and I
had to add another condition in my validation stating that if the source is
bigger than 3 ,don't send it for lookup:-)

Quote:
IF DTSSource("Col002").Value <> "P1" AND
IsNumeric(DTSSource("Col002").Value ) AND
Len(Cstr(DTSSource("Col002").Value)) < 3 THEN
IF DTSLookups("UserLookup").Execute(DTSSource("Col002 ").Value) > 0
THEN
Validation =TRUE
END IF
end if

Thanks Allan for your nice replies.




"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote

Quote:
Have a look at all the values for Col002

Do this in QA

select ISNUMERIC('£')

It returns a 1 whereas this is most definitely not a number.

Allan

"RayAll" <RayAll (AT) microsft (DOT) com> wrote


I am using a simple lookup liske this :

SELECT COUNT(USERID) AS countID
FROM dbo.user
WHERE (IS_ACTIVE = 'Y') AND (USERID= ?)

USERID =(numeric(3,0),not null)

and I am trying to send it the value through my activex code as this

IF DTSSource("Col002").Value <> "P1" AND IsNumeric(
DTSSource("Col002").Value ) THEN
IF DTSLookups("UserLookup").Execute(DTSSource("Col002 ").Value) > 0
THEN
Validation =TRUE
END IF
end if
but I'm getting this error:

microsoft ole db provider for sql server invalid character value for cast
specification


Thanks for your help




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.