Unix Technical Forum

Locking on UPDATE not being released

This is a discussion on Locking on UPDATE not being released within the MS SQL ODBC forums, part of the Microsoft SQL Server category; --> I have a VFP8 application that calls a stored procedure in SQL 2K that runs the follwoing TSQL... update ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > MS SQL ODBC

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-27-2008, 08:12 PM
Michael
 
Posts: n/a
Default Locking on UPDATE not being released

I have a VFP8 application that calls a stored procedure in SQL 2K that runs
the follwoing TSQL...

update dbo.interview_activity
set status_filename = @status_filename
where interview_id = @interview_id and
activitycode_id = 12 and
isnull(status_filename, '') = ''

when this runs, the PK index on the interview_activity table is locked and
subsequent queries by other users are timing out. It took a very long time
to find the code that was causing this slowness, now that I have, I'm not
sure how to fix it. Why woul dthese locks last until the connection is
broken?

The query ofther users are running is a stored procedure call that runs
this...

select *
from dbo.vwInterviewActivity
where vwInterviewActivity.status_filename = @status_filename
order by vwInterviewActivity.interview_id,
questionnaire_number

Much thanks!!


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-27-2008, 08:15 PM
Brannon Jones
 
Posts: n/a
Default Re: Locking on UPDATE not being released

If you execute the update statement in the context of a transaction,
then the locks taken will last for the duration of the transaction. If
you are using a transaction, double check that you are committing it.
If you aren't explicitly using a transaction, or are unsure, you can use
SQL profiler to trace out transaction events.

Brannon

Michael wrote:

> I have a VFP8 application that calls a stored procedure in SQL 2K that runs
> the follwoing TSQL...
>
> update dbo.interview_activity
> set status_filename = @status_filename
> where interview_id = @interview_id and
> activitycode_id = 12 and
> isnull(status_filename, '') = ''
>
> when this runs, the PK index on the interview_activity table is locked and
> subsequent queries by other users are timing out. It took a very long time
> to find the code that was causing this slowness, now that I have, I'm not
> sure how to fix it. Why woul dthese locks last until the connection is
> broken?
>
> The query ofther users are running is a stored procedure call that runs
> this...
>
> select *
> from dbo.vwInterviewActivity
> where vwInterviewActivity.status_filename = @status_filename
> order by vwInterviewActivity.interview_id,
> questionnaire_number
>
> Much thanks!!
>
>

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 12:24 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com