views:

49

answers:

3

I have run this query successfully multiple times no more than a couple of weeks ago. I have not made a single change to it. It seems unlikely that the back-end data would have changed enough to produce no results. What else could contribute to this?

+5  A: 

If it's the exact same query, then it has to be either the data or the database that is being queried that have changed unless you have some sort of temporal/transient filtering in your query, such as filtering on a date range with GETDATE.

So I'd check the following things in order:

  1. It's the exact same query?
  2. Running on the same database?
  3. Does the query filter on time-sensitive data?
  4. Otherwise, I'm guessing the data has changed
Daniel DiPaolo
+1  A: 

to add to @Daniel DiPaolo's excellent answer, if you use a view within your query, it might have changed. And as a real stretch, if you have computed columns that you join or filter on, and the formula has changed, that might cause the rows to not be returned.

KM
A: 

try to recompile the query. the easiest way is to drop and recreate it.

if the query runs now, then a bad queryplan is the cause. this happened in my db. the solution was to add a recompile hint. sounds very bad i know...

Malcolm Frexner