views:

168

answers:

2

I'm running the following statement, it is working locally with SQL Server 2008, however, there is SQL Server 2008 Express on the development server, and after the sql statement runs, I am unable to do SELECT statements on the table in which I deleted the record. Both databases were created with the same table creation scripts.

"DELETE FROM [dbo].[tblMiddayMover] WITH (ROWLOCK)  WHERE [idMiddayMover] = @IdMiddayMover"

What reasons would this statement ever cause the database to hang.

After executing that statement, the following SELECT statement causes an error.

"SELECT * FROM [dbo].[tblMiddayMover] WHERE [fldActive] = 1"

I get the following error:

Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

I can do select statements on any other table with no issues.

I ran the command that was suggested, here is the output. alt text

+1  A: 

It's likely that you have created a transaction around your statement which is still open and has not been committed or rolled back.

I suggest opening another window before the second query times out and execute the procedure "sp_who2". This has a column which will definitively tell you if a query is being blocked by another query (it's called "BlkBy") which is running concurrently.

Dave Markle
57 SUSPENDED scottrends ELEET-SBS2008 56 scottrends INSERT 15 0 03/27 13:11:46 .Net SqlClient Data Provider 57 0
stephenbayer
http://blog.sqlauthority.com/2009/07/19/sql-server-get-last-running-query-based-on-spid/ That will tell you what query last ran on SPID 56. You probably have a transaction open in SPID 56. Find out why the transaction has not committed or rolled back, and you will probably have solved your problem.
Dave Markle
A: 

It was solved. Actually, I was using a code generator to do the stored procs and Data Layer, which created a transaction layer around all the database calls. However, the issue was that it targeted .NET 3.5 and the server was set up to use .NET 2.0. It wasn't a database issue as much as it was an incompatibly issue with the version of .NET on the server.

stephenbayer

related questions