views:

137

answers:

1

Hey guys, I want to ask if there is an equivalent to the @@DBTS TSQL global variable in MySql (I need to access the timestamp of the last row that has been accessed in the whole database, not just one table).

I need this because I'm trying to use Microsoft Sync Framework and MySql for bi-directional syncing.

Any help will be much appreciated. Thanks.

A: 

The closest you can get, as far as I know, is a query like this:

USE INFORMATION_SCHEMA;
SELECT MAX(UPDATE_TIME) FROM TABLES WHERE UPDATE_TIME < NOW();

The INFORMATION_SCHEMA database holds several tables of attributes of all tables in the database. The reason for the WHERE UPDATE_TIME < NOW() clause is that simply by running that query, you cause MySQL to update some of the tables in INFORMATION_SCHEMA, so without the WHERE clause you'd always just get the current time.

Obviously, if your MySQL database is really busy, so that all tables are updated basically every second, this query won't work, but in that case you might as well just sync as often as possible because you know there'll be modifications.

David Zaslavsky
Hey, that did the trick, thanks :)
Tayschrenn