Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running SQL batch 1

Status
Not open for further replies.

developer155

Programmer
Jan 21, 2004
512
0
0
US
Ji I have a situation in the data layer that requires an update stored proc to be executed against db many times in a loop liek this:
for (int c= 0; c< users.People.Rows.Count; c++)
{ DBCommandWrapper cw = _db.GetStoredProc("dbo.AddPersonToPeople");
database.ExecuteNonQuery(cw);}

So the proc will be executed mutiple times, sometimes hundreds. Is there a way to batch all the statements either on ASP.NET side or SQL server side(i.e. stored proc that accepts parameters array, etc.)? Whats the best approach. I definately want to run this once

thanks!
 
i.e. stored proc that accepts parameters array, etc.
Yes, that's possible. Have a look in the SQL Server forum's FAQ section and if it has not been covered, ask them the question on how to implement it.


------------------------------------------------------------

Mark,
[URL unfurl="true"]http://aspnetlibrary.com[/url]
[URL unfurl="true"]http://mdssolutions.co.uk[/url] - Delivering professional ASP.NET solutions
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top