all groups > sql server dts > june 2007 >
You're in the

sql server dts

group:

Foreach Loop in DTS on SQL 2000


Foreach Loop in DTS on SQL 2000 Yehuda Katz
6/28/2007 11:37:46 AM
sql server dts:
I am trying to download product data from a supplier to put into an
online store.
The supplier gives me a list of warehouses, and i can only download
from one at a time.

I created a DTS script to download the warehouse specificed in
DTSGlobalVariable("Warehouse"), but i can not figure out how to loop
through the table of warehouses to get each one.

On top of that, i have a table that lists warehouses that should not
be downloaded (because we do not want to sell products from that
category) and i need to make sure that the warehouse that i download
is not on that list.

It seems that another DTS would work best, but i am also open to other
suggestions.
Re: Foreach Loop in DTS on SQL 2000 Wedocomputers NO[at]SPAM gmail.com
6/28/2007 12:18:11 PM
[quoted text, click to view]

You can use a subquery to take care of the warehouses you do not want
to get.
ex.
SELECT * FROM Warehouses WHERE warehousenumber NOT IN (SELECT
warehouse FROM NotWarehouses)

I have absolutely no idea about your other question
Re: Foreach Loop in DTS on SQL 2000 Allan Mitchell
6/29/2007 6:57:41 AM
Hello Yehuda,

I am not sure of you have 1 table of warehouse info and you want to get the
data for each warehouse seperately or that you have n tables of warehouse
information and you need to loop through tables.

Here is an idea about an Recordset Loop which it sounds like you may need
certainly in the first example

http://www.sqldts.com/298.aspx

As for looping through tables you could follow a very similar approach.
When you pick up a table name then you check to make sure it is not the one
you do not want.

Make sense?


--

Allan Mitchell
http://wiki.sqlis.com | http://www.sqlis.com | http://www.sqldts.com |
http://www.konesans.com

[quoted text, click to view]

Re: Foreach Loop in DTS on SQL 2000 Yehuda Katz
6/29/2007 9:11:59 AM
Thanks,
Works well.
[quoted text, click to view]

AddThis Social Bookmark Button