Calling a stored procedure simultaniously from multiple threads in asp.net and sql server 2005

别等时光非礼了梦想. 提交于 2019-12-24 05:38:51

问题


Is it possible to call a stored procedure from multiple threads simultaneously?

I want to know whether this is possible in sql server 2005. How does SQl server handle this?

Will it throw an error or will it create multiple instance of the stored procedure and run it?

I know i should use locks for this. But I want to know what will happen if I don't.

Thanks, Syd


回答1:


Yes, this is possible.

SQL Server will handle this fine - that's what databases do, handle multiple connections simultaneously.

I don't know what you mean by "multiple instance of the stored procedure" - there is only one definition of a SP in the database and that will get executed. It can be executed by many threads if needed. The database will handle the concurrency for you.

Use of locks depends on the application and how you access the database (and the meaning of the actions you take - whether they need to be atomic/serializable etc).



来源:https://stackoverflow.com/questions/6690889/calling-a-stored-procedure-simultaniously-from-multiple-threads-in-asp-net-and

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!