Uri Dimant
3/21/2007 11:49:00 AM
Valerie
When you perfrom this statement (btw why do you use '*' instead of
specifying names of the columns and why don't you have a WHERE condition?)
SQL Server creates shared lock. This type of locks prevents the locked
resource from receiving an exclusive lock, so if another user runs a query
that need to UPDATE a row, they will not be able to until all of the shared
locks on the row are gone. It looks strange in your case because as you said
there is no another process that wants to UPDATE the table.
I'd run SQL Server profiler to identify what is going on.
"Valerie Hough" <sales@pcTrans.com> wrote in message
news:u98A816aHHA.4012@TK2MSFTNGP03.phx.gbl...
> Client is using SQL Server 2000 SP4.
>
> They are getting SQL Error 1205, State 50 while reading results from a
> view
> as follows:
>
> string connStr = "Server=MyServer;" +
> "IntegratedSecurity=SSPI;"
> "Pooling=true;" +
> "Initial Catalog=MyDatabase";
>
> string cmdStr = "SELECT * FROM MyView";
>
> SqlConnection sqlConn = new SqlConnection( connStr );
> sqlConn.Open();
> SqlCommand sqlCmd = new SqlCommand( cmdStr, sqlConn);
> SqlDataReader sqlRdr = sqlCmd.ExecuteReader();
>
> while( sqlRdr.Read() )
> {
> // get result columns for each record
> }
>
> sqlRdr.Close();
> sqlConn.Close();
>
> This view does get executed alot, especially when 5 users are pounding
> away
> at the keyboards, and there are about 60 columns in each result row.
>
> Can anyone please help me understand how deadlocks can occur during an
> operation that as far as I can tell does nothing but read from a
> predefined
> view?
>
> Any suggestions for helping diagnose and fix the problem. It may be my
> imagination, but I think this did not happen before SQL Server was
> upgraded
> to SP4.
>
> Thanks in advance.
> Valerie Hough
>
>
>