Solved

doing a loop in a DTS Job in Sql server 2000

Posted on 2006-07-11
4
312 Views
Last Modified: 2012-05-05
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
0
Comment
Question by:jcook32
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 12

Expert Comment

by:Einstine98
ID: 17084245
As far as I know the VBScript step will fire for each row...
0
 

Author Comment

by:jcook32
ID: 17084593
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
0
 
LVL 12

Accepted Solution

by:
Einstine98 earned 125 total points
ID: 17084642
why do you use a vb script for this? try using a SQL Query step with this

INSERT INTO HardwareInventory_LaptopInfoRecords
                      (MainID, LaptopItemID)
SELECT     ID, LaptoptModemCord
FROM         HardwareInventory_ImportedData
WHERE     (LaptopModemCord = '1')

this will insert everything for you.. and will be quicker
0
 

Author Comment

by:jcook32
ID: 17084818
that worked like a charm

thanks
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question