From: Marek Grolms on
Hi ,
I have some quesation about Locks in the sql 2005.In the application I call
50x delete where I delete from table rows with specific range datetime.Why
this command locks second delete and not run paralel ?

thanx

From: Andrew J. Kelly on
Can you be more specific? What do you mean 50x delete? SQL Server code just
like nay other code is basically procedural in which the first command needs
to finish before the second one can start. How exactly are you calling
these deletes?

--
Andrew J. Kelly SQL MVP
Solid Quality Mentors


"Marek Grolms" <grolms(a)volny.cz> wrote in message
news:u$LxAx36IHA.2336(a)TK2MSFTNGP03.phx.gbl...
> Hi ,
> I have some quesation about Locks in the sql 2005.In the application I
> call 50x delete where I delete from table rows with specific range
> datetime.Why this command locks second delete and not run paralel ?
>
> thanx

From: Marek Grolms on
HI
I have webservice which delete , insert a update data from sql database.
sqlcon.Open();
sqlcom.CommandText = string.Format("delete from do_denni WITH (ROWLOCK)
where oscislo = {0} and convert(datetime,'{1}',104) <= datum and
DATEADD(dd,1,convert(datetime,'{2}',104)) <= datum ", oscislo,
datumod.ToString("dd.MM.yyyy"), datumdo.ToString("dd.MM.yyyy"));
sqlcom.ExecuteNonQuery();

in delete i delete rows for person with specific date range .... After
delete this I insert new rows . The webservice is called 50x in the same
time.....

thanx

"Andrew J. Kelly" <sqlmvpnooospam(a)shadhawk.com> wrote in message
news:eMCOG936IHA.3672(a)TK2MSFTNGP04.phx.gbl...
> Can you be more specific? What do you mean 50x delete? SQL Server code
> just like nay other code is basically procedural in which the first
> command needs to finish before the second one can start. How exactly are
> you calling these deletes?
>
> --
> Andrew J. Kelly SQL MVP
> Solid Quality Mentors
>
>
> "Marek Grolms" <grolms(a)volny.cz> wrote in message
> news:u$LxAx36IHA.2336(a)TK2MSFTNGP03.phx.gbl...
>> Hi ,
>> I have some quesation about Locks in the sql 2005.In the application I
>> call 50x delete where I delete from table rows with specific range
>> datetime.Why this command locks second delete and not run paralel ?
>>
>> thanx
>

From: Fred on
Dans : news:ev2rht76IHA.1468(a)TK2MSFTNGP05.phx.gbl,
Marek Grolms �crivait :
> HI
> I have webservice which delete , insert a update data from sql
> database. sqlcon.Open();
> sqlcom.CommandText = string.Format("delete from do_denni WITH
> (ROWLOCK) where oscislo = {0} and convert(datetime,'{1}',104) <=
> datum and DATEADD(dd,1,convert(datetime,'{2}',104)) <= datum ",
> oscislo, datumod.ToString("dd.MM.yyyy"),
> datumdo.ToString("dd.MM.yyyy")); sqlcom.ExecuteNonQuery();


First of all, you should correct your code to use SqlParameters instead
of String.Format parameters.
Have a look at SQL Injection in MSDN or on the web.

--
Fred
foleide(a)free.fr

From: Uri Dimant on
Marek
What is an output? Do you have any indexes define on the tables?

ELECT resource_type, resource_description,

resource_associated_entity_id, request_mode, request_status

FROM sys.dm_tran_locks

WHERE resource_associated_entity_id > 0


"Marek Grolms" <grolms(a)volny.cz> wrote in message
news:ev2rht76IHA.1468(a)TK2MSFTNGP05.phx.gbl...
> HI
> I have webservice which delete , insert a update data from sql database.
> sqlcon.Open();
> sqlcom.CommandText = string.Format("delete from do_denni WITH (ROWLOCK)
> where oscislo = {0} and convert(datetime,'{1}',104) <= datum and
> DATEADD(dd,1,convert(datetime,'{2}',104)) <= datum ", oscislo,
> datumod.ToString("dd.MM.yyyy"), datumdo.ToString("dd.MM.yyyy"));
> sqlcom.ExecuteNonQuery();
>
> in delete i delete rows for person with specific date range .... After
> delete this I insert new rows . The webservice is called 50x in the same
> time.....
>
> thanx
>
> "Andrew J. Kelly" <sqlmvpnooospam(a)shadhawk.com> wrote in message
> news:eMCOG936IHA.3672(a)TK2MSFTNGP04.phx.gbl...
>> Can you be more specific? What do you mean 50x delete? SQL Server code
>> just like nay other code is basically procedural in which the first
>> command needs to finish before the second one can start. How exactly are
>> you calling these deletes?
>>
>> --
>> Andrew J. Kelly SQL MVP
>> Solid Quality Mentors
>>
>>
>> "Marek Grolms" <grolms(a)volny.cz> wrote in message
>> news:u$LxAx36IHA.2336(a)TK2MSFTNGP03.phx.gbl...
>>> Hi ,
>>> I have some quesation about Locks in the sql 2005.In the application I
>>> call 50x delete where I delete from table rows with specific range
>>> datetime.Why this command locks second delete and not run paralel ?
>>>
>>> thanx
>>
>