Importing and changing data

  • I am importing data from a comma dilimited file in to an "employee" table. All employee numbers begin with 0. I want to import the employee number and convert the 0 to the letter X. Is this a two step Process? Help thanks.

  • You can do it in many ways.

    Just import the data to the table and exec the Update stmt to chage the employee number on the table.If it is a Pk on that table, then you can't update.

    If itz PK for that table,then tranfer into the temp table and update the value and transfer the data from temp table to Employee tbl.

    Edited by - spdhiva on 04/10/2003 11:12:34 AM

  • Is it possible to do it with out dumping into a temp table? Yes it is the PK for the target table.

  • We can do it thro' active x scripts

    --First You have to open the text file and change the filed on the text file.

    --Transfer the data from changed text file to tbl.

    I don't know whether you want to right the VB scripts for this.

    The best method,Just create and drop the temp table and do the data validation.Itz all in background.

  • Hi use lookups...

    example

    http://www.sqldts.com/default.aspx?6,107,277,7,1

    JFB

  • I got this to work by using a transform VB Script function. Click on the transform button in the DTS import wizard and use the following script. Replace x with the lenth of your employee number.

    '**********************************************************************

    ' Visual Basic Transformation Script

    '************************************************************************

    ' Copy each source column to the destination column

    Function Main()

    s = "X" & Right( Cstr(DTSSource("EmplIdInFile")), x)

    DTSDestination("TableEmplId") = s

    Main = DTSTransformStat_OK

    End Function

    Darren


    Darren

  • The script did exactly what I needed it to do. Thanks from a Newbie!

Viewing 7 posts - 1 through 6 (of 6 total)

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