all groups > sql server dts > may 2006 >
You're in the

sql server dts

group:

Looping Query not working


Looping Query not working Kayda
5/11/2006 9:15:36 AM
sql server dts:
Hi:

I have a loop that sets the source database source and runs the same
query against a different database that it did the previous loop. So,
like this

Source_DB_1
Table1

Source_DB_2
Table1

Destaination_DB
Table1

It loops through the first source DB and runs a query on Table1 on the
first source server and writes to the Destination DB Table1. Then it
loops through the loop again and writes from the same table on the
second source to the same destination table on SQL Server. It sets the
course DSN and query from an ActiveX task.

Problem is, it worked before but now doesn't seem to be getting data
from the second source. If I run the package it appears to go through
the loop twice for the two sources. If I look at the source db
properties after it is run, the DSN has been changed for the second
source correctly. The query on the DataPump task has been set
correctly. The weird thing is, If I right-click on the DataPump task
after I run it and choose "Execute Step", it runs AND THEN pumps the
data correctly to the destination DB.

I'm pulling my hair out with this one--why does it have the correct
source and the correct query but writes no data to the destination DB
when executed as part of the whole package? The loop is working fine,
it is setting the source correctly, it is setting the query correctly,
but only runs when I execute the step discreetly after the package has
run. I would expect to get an error if something was wrong, but it
tells me it worked ok.

Any ideas?

Thanks,
Kayda
Re: Looping Query not working Kayda
5/11/2006 11:15:10 AM
Further to this, I tried turning off "Use Fast Load" on the data pump
task, but to no avail.

If you need any more info to answer this, let me know-I'm grasping at
straws and this is pretty urgent.

Thanks in advance,
Kayda
Re: Looping Query not working Kayda
5/11/2006 11:17:53 AM
One more thing-if I reverse the information for the two source servers
(I keep the DSN name, username and password locally on SQL Server), the
server listed first in the database will work. So it has something to
do with the order of execution within the package.
RE: Looping Query not working Darren Green
5/12/2006 7:43:02 AM
This is common issue which is solved by setting the Close connection
on completion for the last task that uses the connection. This forces the
connection to be reopened which means it picks up the new details.
--
http://wiki.sqlis.com | http://www.sqlis.com | http://www.sqldts.com


[quoted text, click to view]
AddThis Social Bookmark Button