Reputation: 2101
I'm trying to do a query that gets all the ids from a table where the column document(varbinary(max)) is null
.
The query always timesout, and I'm running it against a 5000-row table.
select ID from Invoice where Document is null
Im using SQL Express 2008 R2 and Sql Management Studio. Is this the right way? Am I missing something? Even if I add top 1 the query time out
Upvotes: 2
Views: 3368
Reputation: 18812
If connecting on localhost Then
If connecting from Management Studio Then
Try restarting SQL Server services...could be locks.
Try restarting machine...could be locks.
ElseIf connecting from remote app code Then
Check if SQL Server is setup for remote connections.
Check connection strings.
Check seccurity privleges.
Check log file.
End If
Else
Check if SQL Server is setup for remote connections
Check connection strings.
Check seccurity privledges.
End If
Upvotes: 1
Reputation: 107806
Do it this way, for a read-only look
select ID from Invoice (nolock) where Document is null
Upvotes: 1
Reputation: 9784
Sometimes the tables gets locked. Try clicking away from the selected Table in your interface.
What RDBMS are you using? SQLserver? Sybase? or..
Does it still time out when you do:?
SELECT TOP 10 ID
from Invoice where Document is null
Upvotes: 4