Solved

doing a loop in a DTS Job in Sql server 2000

Posted on 2006-07-11
4
306 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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

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…
Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.

749 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