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 res开发者_JAVA百科ults. What else could contribute to this?
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:
- It's the exact same query?
- Running on the same database?
- Does the query filter on time-sensitive data?
- Otherwise, I'm guessing the data has changed
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.
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...
精彩评论