Link to home
Start Free TrialLog in
Avatar of jcook32
jcook32Flag for United States of America

asked on

doing a loop in a DTS Job in Sql server 2000

I need to run a loop around this block of code:
'**********************************************************************
'  Visual Basic Transformation Script
'************************************************************************

'  Copy each source column to the destination column
Function Main()
dim MainID      

      MainID = DTSLookups("GetRecordWithItem").Execute()
      DTSLookups("InsertLaptopItem").Execute(MainID)
      'DTSDestination("MainID") = DTSSource("ID")
      'Main = DTSTransformStat_OK
End Function

the DTSLookup GetRecordWithItem returns multiple records from a table
i need to run the insertLaptopItem for each of the mainId rows.

Please Help
Thanks
jcook32
Avatar of Einstine98
Einstine98

As far as I know the VBScript step will fire for each row...
Avatar of jcook32

ASKER

that is correct.
here are my look ups
SELECT     ID
FROM         HardwareInventory_ImportedData
WHERE     (LaptopModemCord = '1')

this will return many rows

INSERT INTO HardwareInventory_LaptopInfoRecords
                      (MainID, LaptopItemID)
VALUES     (?, 1)

i want to do an insert for each ID returned.

it is creating the records but the mainID field is the same for all records. 1
ASKER CERTIFIED SOLUTION
Avatar of Einstine98
Einstine98

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jcook32

ASKER

that worked like a charm

thanks