Sql-server – How to write a script to push the server time to out

ms accesssql server

Background:

I am programming a database in Ms-Access and using SQL-server as the Back-end. But since my database will be a multi-user platform I need to make sure that whenever a user is posting data into the back-end that their computer time is the same as the SQL-server time to ensure that record locking is being effectively used and the data is being timestamped properly.

Extra gibberish:

I only had a major concern for this when I saw a user in my company with his computer time set in the future!!! He was exactly 12 years ahead of us but had no idea! Hence this I have been searching for a solution to keep everyone on the same page.

Question:

Is it possible to write a script that will push the SQL-server time out on to networked client computers?

Best Answer

Unfortunately, you're trying to solve a problem with an inherently broken design: relying on a user-editable client-side variable to determine object version is never going to work perfectly.

Forcing time synchronization on the domain may help, but clients can still be out-of-sync, either because of clock drift, or because the user is a local admin and therefore has permissions to change the clock manually at any time, to any time.

Normally a server-side value such as an ever-increasing integer row version number is used for concurrency control instead of a client-side-generated value.

Also, if you're recording auditing information, as much of it as possible (particularly time values) should be generated by the server for both security and synchronization reasons.