Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Other SQL Server Topics (2005)
 Thread latency?
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

United Kingdom
3 Posts

Posted - 07/09/2012 :  07:47:51  Show Profile  Reply with Quote
I have an occasional issue which is puzzling me:
We have an application that writes to file (camera recording data), stores the filepaths in a SQL table and changes the files and folders fairly frequently, when this happens it updates a SQL tables.

I am writing a separate service to monitor that the system does indeed write to file regularly. This queries the system for the cameras and their current file paths, then periodically checks the modified timestamp on the file. When this is older than now - a threshold we raise an alarm.

The issue: occasionally my code detects the file has not been written to - it then checks the database to see that the file has not been changed - (the monitored system will update the file tables) I get the old file paths back. So using the VC 2005 C++ debugger I break at this point in my code and go back and rerun the query ... then I get the new paths.???
So I tried on the first detection of no write - to set an entry in map to and recheck on the next polling cycle (8 seconds later in the test case) quite often this too fails.
But if then step through with the debugger - re run the query - and It returns the new file path! Aghhh!!!

Is there a way I can force SQL Server to flush any internal caches perhaps?
Any thoughts would be very much appreciated!

Flowing Fount of Yak Knowledge

United Kingdom
3385 Posts

Posted - 07/09/2012 :  07:51:41  Show Profile  Visit nigelrivett's Homepage  Reply with Quote
Doubt if it's sql server.
Try using the profiler to see if the query is being run on the database.
I suspect there is something which caches the data for a time and you need to change it to refresh on every query.

Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

Starting Member

United Kingdom
3 Posts

Posted - 07/09/2012 :  08:54:43  Show Profile  Reply with Quote
Yes reckon so.
I see you are a CAMRA man! Ideal!
I need to figure out where the details are being cached and a way to clean the cache.
We have no SLA on the server code doing its thing with in a defined time frame.

I will investigate further
Many thanks for tips

Have you tried Stanway's special ?

Go to Top of Page

Starting Member

United Kingdom
3 Posts

Posted - 07/11/2012 :  03:00:12  Show Profile  Reply with Quote
Sorted: it was nothing to do with SQL Server - it was due to the fact that windows does not necesarily update the last modified timestamp regularly on a file.

Thanks Nigel for your help

Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.04 seconds. Powered By: Snitz Forums 2000