Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 Execute SQL Task not passing parameter

Author  Topic 

LOOKUP_BI
Constraint Violating Yak Guru

295 Posts

Posted - 2010-01-06 : 16:45:23
I have the following to be done.Read list of servers form table A, get corresponding list of database from table B for servers in table A and execute some queries to get information of each db and insert the results to my local server/ws.

What I have done so far is,
1) Create execute sql task with result set as return, 'select srvname from table A' and store results in obj srvlist

2) Create For Each Loop and connect to 1).ADO enumerator.ADO obj source var= srvlist.parameter mapping = servername [var of type string]

3) Within 2) create execute SQL Task, with following
'select dbname from B where srvname= '?' and report=1'
parameter mapping = servername ,result set = obj server_name

4)Create a for each loop and connect 3) to it. ADO enumerator.ADO obj source var = server_name, parameter mapping = dbname [var of type string]

To test valus being passed.

5) Include a script task to pop up a Msg Box, that prints results of dbname within For Each Loop in 4)

My problem is, i can see value changing in the watch window for step 2).But as soon as it hits the 4) step it does not execute the script task within and ends without errors.

There are no errors.Do advize me, as I have been trying to reconfigure the for loop many many times.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-01-07 : 00:58:00
so is 4 inside first for each loop?have you tried putting a preexecute breakpoint for 4 and checking the value for dbname?
Go to Top of Page

LOOKUP_BI
Constraint Violating Yak Guru

295 Posts

Posted - 2010-01-07 : 10:45:52
Yes 4) is inside the 2) for each loop.
Yes I added a breakpoint on 4),the only thing I see is these values
server_name = System.Object
dbname ={} Empty

Some Testing That I did
1) Create individual for each loop to return list of server ip address only.Connect to script task.Looped fine and pop up with ip address
2)Create individual for each loop to return db name based server ip address provided.Connect to script task.Looped fine and pop up with db name.

As soon as I put the 4) for each loop into 2) for each loop.I have the problem.

Any help ?
Go to Top of Page
   

- Advertisement -