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
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).