October 4, 2005 at 3:40 pm
I wrote a simple search stored procedure that returns a bunch of records based on number ranges and text matches. I "copied to the clipboard" an execute statement and replaced the variables with hard coded values to test the proc. Nothing was returned. I purposely ran this procedure with empty strings and large values (the proc uses a lot of LIKE's and IN's, etc.) expecting it to return all the records (there are only 3 at the moment) when in fact it returned nothing.
I added another string to one of the IN conditions of the WHERE and when I ran it again passing a value that would validate that IN statement, my query returned the one record that matched.
After that I passed in the original parameters (that returned nothing) and this time and about 10 subsequent times later using the same values, when I ran the query, it returned the same, 1, record!?!? What's that all about?
So I ask you, is Query Analyzer or SQL Server itself caching this result set? It just doesn't make sense.
Thanks,
Paul
October 4, 2005 at 7:53 pm
SQL Server will cache the Query Plan, so subsequent runs of the same, (or very similar) queries should return results quicker. But, it does not cache the results.
Can you give us a snippet of the code and changes you made? It sounds as if it may be really long, but having the code should help in figuring out why you may be getting the results you recieve.
I wasn't born stupid - I had to study.
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply