jcook32
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("GetRecordWithI tem").Exec ute()
DTSLookups("InsertLaptopIt em").Execu te(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
'*************************
' Visual Basic Transformation Script
'*************************
' Copy each source column to the destination column
Function Main()
dim MainID
MainID = DTSLookups("GetRecordWithI
DTSLookups("InsertLaptopIt
'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
As far as I know the VBScript step will fire for each row...
ASKER
that is correct.
here are my look ups
SELECT ID
FROM HardwareInventory_Imported Data
WHERE (LaptopModemCord = '1')
this will return many rows
INSERT INTO HardwareInventory_LaptopIn foRecords
(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
here are my look ups
SELECT ID
FROM HardwareInventory_Imported
WHERE (LaptopModemCord = '1')
this will return many rows
INSERT INTO HardwareInventory_LaptopIn
(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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
that worked like a charm
thanks
thanks