SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Handling Stored Procedure


Handling Stored Procedure

Author
Message
abivenkat
abivenkat
Forum Newbie
Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)

Group: General Forum Members
Points: 3 Visits: 12
Hi all,

I am developing a console application. After doing the initial checks and pre requisites, i have to introduce 5 threads based on the sql table's rows. say for example, if my table consist of 1000 rows, then i will have to split up the rows and assign equally to all 5 threads, where in this case, i will do the split and assign (creating a datatable) 200 rows to each thread and then all 5 threads would call the SP at the same time with the datatable. Is there any thing to be handled in the SP, since it is going to get executed parallely by 5 threads and how can i handle the insert, delete and truncates inside the SP? will it be a problem, if more than one insert or delete or truncate queries executed at the same time, is there any collision occurs? or is there any lock functionality in SP to allow only one operation for a sql statement in SP?

As i am new to this to kind of requirement, i need help in finding out the problems which is occurs possibly and way to overcome it. it would be great if i get any tips and tricks to follow in this kind of scenario..

Thanks in advance..

abivenkat
Bhuvnesh
Bhuvnesh
SSChampion
SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)

Group: General Forum Members
Points: 12634 Visits: 4077
abivenkat (1/22/2013)
since it is going to get executed parallely by 5 threads and how can i handle the insert, delete and truncates inside the SP? will it be a problem, if more than one insert or delete or truncate queries executed at the same time, is there any collision occurs? or is there any lock functionality in SP to allow only one operation for a sql statement in SP?
Sql server will not do it Simultaneously. it will get performed sequentially.plus you dont need to handle/worry about the DML operation , sql server wil hendle them smartly/intelligently with the help of lock mechanism. this compltete terminology called "transaction". so there will be no collision (yes there coulds be some blocking while DML operation perform but only for small intervals in normal scenario).
You should read some articles related to

1) transaction
2) locks
2) isolation level.

-------Bhuvnesh----------
I work only to learn Sql Server...though my company pays me for getting their stuff done;-)
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search