Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2006
    Posts
    7

    Unanswered: DTS String to Date conversion problem

    Hi;

    I am attempting to import records from a text file.

    This text file is a report file created by a mainframe routine, if this makes any difference.

    When I attempt to transform the file via a VB Script it craps out when I use
    the CDate(). An example of the script:

    Destination("A_Date") = CDate(Source("Column1").

    Some of the columns in the text file contain the string value "(Null)" and
    some rows have that column containing a "01/05/06".

    I have tried testing for the the string value "(Null)" but that doesn't solve my problem.

    Are there any other VB functions that I could use ?

    Thanks,

    NeedSomeHelp

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    You haven't explained what the problem is.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  3. #3
    Join Date
    Feb 2006
    Posts
    7

    Lightbulb Problem with converting strings to date fields with DTS

    Hi;

    I did have a problem trying to import string data fields into smallDate columns.


    Some of the columns in the text file contain the string value "(Null)" and
    some rows have that column containing a "01/05/06". The (Null) strings
    also had varying lengths of trailing spaces.


    A colleague suggested that I add a item to test for in my IF statement.

    When I included LEFT(field,1) <> "(" the VB Script worked.

    So I part of my script went :
    If LEFT(textField,1) <> "(" THEN
    DTSDestination("Date1") = CDate(DTSSource("Column")
    End IF

    Testing for the first parenthesis eliminated the (Null) without having to deal
    with trailing spaces.

    Hope this might shed some light on a similar issue.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •