Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2002
    Posts
    1

    Question Unanswered: Trouble with looping in DTS script

    I have the following DTS script, which when it runs my rows get overwritten. My source is a text file that has 58 columns, my destination is a SQL table with 8 columns.
    I want to cycle through the text file 1 row at a time pulling the first 6 columns plus the 7th column into row 1 of my SQL Table. I then want to pull those same six rows plus the 8th column into row 2 of my SQL table. I want to continue doing this until I've reached the end of row 1 in my text file, and then begin over again with row 2..3..4..5..etc of the text file. If there is any way to append records after the first loop? that would fix my problem. Thanks in advance.

    Function Main()
    Dim i
    For i = 1 to 52
    DTSDestination("Import_Date")=DTSSource("F1")
    DTSDestination("Site")=DTSSource("F2")
    DTSDestination("Item_Number")=DTSSource("F3")
    DTSDestination("Item_Desc")=DTSSource("F4")
    DTSDestination("Weight")=DTSSource("F5")
    DTSDestination("On_hand")=DTSSource("F6")
    DTSDestination("Week")=(i)
    DTSDestination("Value")=DTSSource("F"&Cstr(i+6))

    next

    Main = DTSTransformStat_OK

    End Function

  2. #2
    Join Date
    Feb 2002
    Posts
    14
    add a switch to your pgm.

    Ex.

    dim cntr

    cntr = 0

    for i = 1 to 52

    if cntr = 0 then
    exec combo1 (code snipped)
    else
    exec combo2

    if cntr = 0 then
    cntr = 1
    else
    cntr =1

Posting Permissions

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