• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 134
  • Last Modified:

Execute Stored Procedure for a set of values

I have around 10 Stored Procedures each of which takes one argument as an input parameter. I have a table of around 200 ids against which I want to run these 10 stored procedures.  What is the best way of executing this ? Also for each id for each stored procedure run I would like a count of the number of records affected or the stored procedure to return a true or false.

Please let me know if you have any other questions,
Thanks,
Aditya
0
giveindia
Asked:
giveindia
  • 2
  • 2
1 Solution
 
ste5anSenior DeveloperCommented:
What is the best way of executing this ?
It solely depends on your procedures internals. Whether the order should/could be a(1), b(1), c(1)..a(n), b(n), c(n) or a(1),a(2),a(3)..c(1),c(2),c(3)).

"How to execute this?"
Create a cursor and invoke the methods. Don't think about using dynamic SQL, when you cannot justify its usage.

for each id for each stored procedure run I would like a count of the number of records affected or the stored procedure to return a true or false.
It solely depends on your procedures internals. When the procedures do not expose those numbers, there is no way to get them. Cause to calculate it otherwise means that you need to replay the sprocs internals.
0
 
giveindiaAuthor Commented:
Nevermind. I handled it through a console application written in .NET.

Thanks,
Aditya
0
 
giveindiaAuthor Commented:
Nevermind. I handled it through a console application written in .NET.

Thanks,
Aditya
0
 
ste5anSenior DeveloperCommented:
You've asked for the best method. Using .Net is not the best method, cause it requires an extra layer in a different technology.

Also my caveat still holds: You cannot rely on the records affected value.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now