Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Empty Strings in import file for datetime

Status
Not open for further replies.

mapfax

Technical User
Apr 23, 2002
29
0
0
GB
Using DTS to import a fixed width text file with julian dates. ActiveX script converts julian to datetime, but some fields are (0x20) padded. So I can have [..123],[.1123], [99123],[.....]empty. The empty field is causing me a problem - type mismatch error: '(string:" ")'.
I have read about this in many guises but I am not sure which applies to this scenario (Case, Convert, NULL, Is[NOT]Null, BCP, BULK Insert, etc). Any suggestions?

My script looks roughly like this:

If (DTSSource("Col029")) > 0 Then --I'VE TRIED =" "
call SetJulianDate (DTSSource("Col029"), JulianDate, Error_Code)
end if
...
call ConvertJulianToStandard (JulianDate, FromDate, Error_Code)
...
DTSDestination("DOB") = FromDate



 
sorry, last post should have read:

--I've tried <> &quot; &quot;
 
You have to handle the case &quot; &quot; in a separate else statement:

If (DTSSource(&quot;Col029&quot;)) <> &quot; &quot;
call SetJulianDate (DTSSource(&quot;Col029&quot;), JulianDate, Error_Code)
...
call ConvertJulianToStandard (JulianDate, FromDate, Error_Code)
...
DTSDestination(&quot;DOB&quot;) = FromDate

else

DTSDestination(&quot;DOB&quot;) = Null

End If
 
Thanks for your help, I've added your advice to the code. However, despite what I had previously said I found checking

<> &quot;&quot;

worked! Confused I am...confused. Thanks anyway.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top