Intelligent Automation & Macro Software  

Go Back   Automation Anywhere, Inc. Forums > Products Zone > Automation Anywhere
Register FAQ Search Today's Posts Mark Forums Read

Automation Anywhere Post messages and questions related to Automation Software here.


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-12-2010, 04:42 AM
exeterfan exeterfan is offline
Junior Member
 
Join Date: Mar 2010
Posts: 2
Default Nested SQL Queries

Hello,

I'm currently trying to do a nested SQL query.

Breakdown of the steps I'm taking is:

Create SQL connection session1
Run SQL query 1 under session1
Loop through each row of session1
...
Other tasks
...
Create SQL connection session2
Run SQL query 2 (with variable gained from query 1 dataset) under session 2
Loop through each row of session2
...
Other tasks
...
End Loop 2
Disconnect SQL connection session2
End Loop 1
Disconnect SQL connection session1


Is this the right way of going about this? I'm encountering issues where the second loop doesn't seem to be reading from query 2 dataset plus I don't like having to have multiple connections to the same Database.
Reply With Quote
  #2 (permalink)  
Old 03-15-2010, 12:27 AM
forumsupport forumsupport is offline
Senior Member
 
Join Date: Apr 2007
Posts: 1,342
Default

Hello,

Yes this should work. We can move command that connects to database using session2 at the beginning. Text format would appear as follows,

Create SQL connection session1
Create SQL connection session2

Run SQL query 1 under session1
Loop through each row of session1
...
Other tasks
...

Run SQL query 2 (with variable gained from query 1 dataset) under session 2
Loop through each row of session2
...
Other tasks
...
End Loop 2
End Loop 1

Disconnect SQL connection session2
Disconnect SQL connection session1

If it does not work, please upload the task so we can have a look and suggest viable solution.

Hope that helps.
Reply With Quote
  #3 (permalink)  
Old 03-15-2010, 08:09 AM
exeterfan exeterfan is offline
Junior Member
 
Join Date: Mar 2010
Posts: 2
Default

Do you also need to set up a new connections if you want to run multiple Stored Procedures?
Reply With Quote
  #4 (permalink)  
Old 03-15-2010, 10:45 AM
TylerMitton TylerMitton is offline
Senior Member
 
Join Date: Nov 2009
Posts: 102
Default

Are you queries all on the same database? If so, you don't need to open a second connection at all. One connection can be used by many queries and stored procedures.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -7. The time now is 03:21 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.0.0 ©2007, Crawlability, Inc.
Copyright © 2003-2011 Automation Anywhere, Inc. All rights reserved