Posted by John Bell on 01/14/06 19:46
Hi Freddie
Looking at the sample you have a leading space therefore the start value for
your mid function should be 3. If that is not the case and it is a scripting
error then you may have other values which will not convert to an integer.
Failing that you may want to talk the CInt conversion out completely and
hope it can be implictly converted.
If you can not rely on the format of the data, then you may want to load the
whole text into a staging table and work with it on SQL Server in a two
stage process.
John
"Freddie" <newwweb@hotmail.com> wrote in message
news:1137095267.551892.188740@z14g2000cwz.googlegroups.com...
> Hello Everyone:
>
> I am loading a text file onto a table. One field is a text and the
> field in my table is a numeric.
>
> Here's a sample of my code....i get (type mismatch) error....can
> someone help me.
>
> sample data to be loaded (" ^876504 ") text
> sample date loaded (87654) numeric
>
> Function Main()
> DTSDestination("test") = CInt(Mid(DTSSource("Col006"),2 , 6))
> Main = DTSTransformStat_OK
> End Function
>
>
> Thank you!!
>
> Freddie
>
[Back to original message]
|