EXTRACT NUMBERS FROM A STRING

  • IN ONE OF THE DTS PACKAGES THAT I HAVE I NEED TO BE ABLE TO EXTRACT NUMBERS FROM A

    DTSSOURCE COLUMN THAT CONTAINS VALUES LIKE

    TANYA SLULLIVAN1245

    TELLER BAKER -2356

     JAME CALVILL\2345

     JAMES HOHN SMITH

    WHAT I NEED IS TO SET THE

    DTSDESTINATION TO

    1245

    2356

    2345

    0

    HOW DO I DO THIS USING ACTIVE X OR WHILE DOING THE TRANSFORMATION.

    THANKS 

    [font="Comic Sans MS"][/font]It is what it is.

  • Using this code in an ActiveX script transformation will do what you want:

     

    Function Main()

     Dim strSource

     Dim strNumbersOnly

     Dim i

     strSource = DTSSource("Col001")

     For i = 1 To Len(strSource)

      If IsNumeric(Mid(strSource, i, 1)) Then

       strNumbersOnly= strNumbersOnly & Mid(strSource, i, 1)

      End If

     Next

     DTSDestination("Col001") = strNumbersOnly

     Main = DTSTransformStat_OK

    End Function

  • it worked . thanks a bunch

    [font="Comic Sans MS"][/font]It is what it is.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply