473,671 Members | 2,550 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Getting System Time From SQL Server

I'm using an Access MDB as a front end to a SQL 7 database. When I place the
system time in a field in Access, it used the user's clock. I'd like to use
the SQL Server system time, so that the times will be synchronized. I
suppose I can just do a pass-through query with "select getdate()." But I
was wondering if there was some built-in method, either in Access or SQL
Server. I'm concerned about the overhead of running a pass-through query
every time I need the current time.

Thanks.
Nov 28 '07 #1
9 8410
Neil (no****@nospam. net) writes:
I'm using an Access MDB as a front end to a SQL 7 database. When I place
the system time in a field in Access, it used the user's clock. I'd like
to use the SQL Server system time, so that the times will be
synchronized. I suppose I can just do a pass-through query with "select
getdate()." But I was wondering if there was some built-in method,
either in Access or SQL Server. I'm concerned about the overhead of
running a pass-through query every time I need the current time.
It you want the time on the server, "SELECT getdate()" is probably the
simplest way to do it. But you could of course make a remote procedure
call outside SQL Server as a little exercise in Windows programming
if you like. I can't see that's worth the pain, though.
--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Nov 28 '07 #2

"Erland Sommarskog" <es****@sommars kog.sewrote in message
news:Xn******** **************@ 127.0.0.1...
Neil (no****@nospam. net) writes:
>I'm using an Access MDB as a front end to a SQL 7 database. When I place
the system time in a field in Access, it used the user's clock. I'd like
to use the SQL Server system time, so that the times will be
synchronized . I suppose I can just do a pass-through query with "select
getdate()." But I was wondering if there was some built-in method,
either in Access or SQL Server. I'm concerned about the overhead of
running a pass-through query every time I need the current time.

It you want the time on the server, "SELECT getdate()" is probably the
simplest way to do it. But you could of course make a remote procedure
call outside SQL Server as a little exercise in Windows programming
if you like. I can't see that's worth the pain, though.
:-) Thanks! Just wanted to make sure I wasn't missing something.
Nov 29 '07 #3
"Neil" <no****@nospam. netwrote:
>I'm using an Access MDB as a front end to a SQL 7 database. When I place the
system time in a field in Access, it used the user's clock. I'd like to use
the SQL Server system time, so that the times will be synchronized. I
suppose I can just do a pass-through query with "select getdate()." But I
was wondering if there was some built-in method, either in Access or SQL
Server. I'm concerned about the overhead of running a pass-through query
every time I need the current time.
In a corporate network everyone should be using a common time source.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
Nov 29 '07 #4
Well, unfortunately that doesn't seem to be the case. Individual computers
vary from the server time by as much as 10 minutes! Is there some sort of
setting to use to use the server time. Maybe I'll pass that along to the
admin and see if he implements it.
"Tony Toews [MVP]" <tt****@teluspl anet.netwrote in message
news:4a******** *************** *********@4ax.c om...
"Neil" <no****@nospam. netwrote:
>>I'm using an Access MDB as a front end to a SQL 7 database. When I place
the
system time in a field in Access, it used the user's clock. I'd like to
use
the SQL Server system time, so that the times will be synchronized. I
suppose I can just do a pass-through query with "select getdate()." But I
was wondering if there was some built-in method, either in Access or SQL
Server. I'm concerned about the overhead of running a pass-through query
every time I need the current time.

In a corporate network everyone should be using a common time source.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/

Nov 29 '07 #5
"Neil" <no****@nospam. netwrote:
>Well, unfortunately that doesn't seem to be the case.
Which is why I put the weasel words "should". <smile>
>Individual computers
vary from the server time by as much as 10 minutes! Is there some sort of
setting to use to use the server time.
Yes, there is however I'm not at all sure how to do it. I think it involves ensuring
a server is hitting an Internet time source on a regular basis. Then, presumably
using group policy, ensure everyone on the network get thier time from the server.
But I'm not an IT person so I have no idea.

Tony

--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
Nov 30 '07 #6
"Neil" <no****@nospam. netwrote:
>Well, unfortunately that doesn't seem to be the case. Individual computers
vary from the server time by as much as 10 minutes! Is there some sort of
setting to use to use the server time. Maybe I'll pass that along to the
admin and see if he implements it.
BTW there are functions to also get the system time from a server and
compare that to the time on the PC. You can use that to show the IT
department.

API: Retrieve NT Server's Time
http://www.mvps.org/access/api/api0039.htm

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
Nov 30 '07 #7
The command line (which should be included in the logon script) is:

net time /DOMAIN:DomainNa me /SET

HtH

Pieter

"Tony Toews [MVP]" <tt****@teluspl anet.netwrote in message
news:uk******** *************** *********@4ax.c om...
"Neil" <no****@nospam. netwrote:
>>Well, unfortunately that doesn't seem to be the case. Individual computers
vary from the server time by as much as 10 minutes! Is there some sort of
setting to use to use the server time. Maybe I'll pass that along to the
admin and see if he implements it.

BTW there are functions to also get the system time from a server and
compare that to the time on the PC. You can use that to show the IT
department.

API: Retrieve NT Server's Time
http://www.mvps.org/access/api/api0039.htm

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/

Nov 30 '07 #8
"Tony Toews [MVP]" <tt****@teluspl anet.netwrote in message
news:uk******** *************** *********@4ax.c om...
>"Neil" <no****@nospam. netwrote:
>>>Well, unfortunately that doesn't seem to be the case. Individual
computers
vary from the server time by as much as 10 minutes! Is there some sort of
setting to use to use the server time. Maybe I'll pass that along to the
admin and see if he implements it.

BTW there are functions to also get the system time from a server and
compare that to the time on the PC. You can use that to show the IT
department.

API: Retrieve NT Server's Time
http://www.mvps.org/access/api/api0039.htm

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/

"Pieter Wijnen"
<it************ *************** *************** *************** *@online.replac e.with.norway>
wrote in message news:O6******** ********@TK2MSF TNGP04.phx.gbl. ..
The command line (which should be included in the logon script) is:

net time /DOMAIN:DomainNa me /SET

HtH

Pieter
Just to be clear, putting that into the user's logon script will set their
PC's time to the server's time?
Nov 30 '07 #9
"Neil" <no****@nospam. netwrote in message
news:8W******** **********@news svr21.news.prod igy.net...
>
>"Tony Toews [MVP]" <tt****@teluspl anet.netwrote in message
news:uk******* *************** **********@4ax. com...
>>"Neil" <no****@nospam. netwrote:

Well, unfortunately that doesn't seem to be the case. Individual
computers
vary from the server time by as much as 10 minutes! Is there some sort
of
setting to use to use the server time. Maybe I'll pass that along to the
admin and see if he implements it.

BTW there are functions to also get the system time from a server and
compare that to the time on the PC. You can use that to show the IT
department.

API: Retrieve NT Server's Time
http://www.mvps.org/access/api/api0039.htm

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/


"Pieter Wijnen"
<it************ *************** *************** *************** *@online.replac e.with.norway>
wrote in message news:O6******** ********@TK2MSF TNGP04.phx.gbl. ..
>The command line (which should be included in the logon script) is:

net time /DOMAIN:DomainNa me /SET

HtH

Pieter

Just to be clear, putting that into the user's logon script will set their
PC's time to the server's time?
To the DOMAIN controller's time.

The SQL server (which in most cases is not a DC) should also synch to the
domain controller.

There's also a registry setting to force it to synch that can be set under
domain policies.

The only time I've had to do the net time /domain: in recent memory was when
the time of the client was so far off that it wouldn't log in properly.

>


--
Greg Moore
SQL Server DBA Consulting Remote and Onsite available!
Email: sql (at) greenms.com http://www.greenms.com/sqlserver.html
Nov 30 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2749
by: PHPkemon | last post by:
Hi there, A few weeks ago I made a post and got an answer which seemed very logical. Here's part of the post: PHPkemon wrote: > I think I've figured out how to do the main things like storing products in
11
2018
by: KarimL | last post by:
Thanks for your advices... but i need to get the Image height because i dynamically resize the height of my webcontrol based on the image height. More i just have the url (relative parth) to the the image but in design time mode all variables concerning Server or Context ar not set ! ...so I can't use MapPath function to obtain the physical parth of the picture ... So my second question is how to retrieve the physical root path of the...
3
3076
by: Hitesh | last post by:
Hi, I am getting the response from another Website by using the HttpHandler in my current site. I am getting the page but all the images on that page are not appearing only placeholder are displayed. Can anybody know this issue and help me to resolve this. In past i received the response saying that i should download the image first and then parse the actual response and modify the src attribute of the
4
13603
by: Pat | last post by:
In my Web.config i have :- <customErrors mode="On" defaultRedirect="genericerror.htm"> <error statusCode="404" redirect="pagenotfound.aspx"/> </customErrors to get page not found error but instead i keep getting a RUN TIME error below: Any ideas.. Runtime Error
2
2347
by: Chad | last post by:
In our application, I would like to send out HTML mail. TO do so, I must do something like this: Mail.Body = <raw HTMLTEXT String> Hence, I would like to know how to get the HTML text for Web Controls. You'll notice below in lines 33-37 that that code does correctlt return the HTML for a textbox. How do I make it generic so it returns the HTML for any control. Hopefully, if the control is a container control, it will return the HTML for...
5
5962
by: Nathan Sokalski | last post by:
I have a user control that contains three variables which are accessed through public properties. They are declared immediately below the "Web Form Designer Generated Code" section. Every time an event is fired by one of the controls contained in the User Control, these variable are reset. Here is my current code (I have a little more to add later, right now I am just concerned about the variables getting reset): Public Class DatePicker2...
4
5997
by: Sean Shanny | last post by:
To all, Running into an out of memory error on our data warehouse server. This occurs only with our data from the 'September' section of a large fact table. The exact same query running over data from August or any prior month for that matter works fine which is why this is so weird. Note that June 2004 through today is stored in the same f_pageviews table. Nothing has changed on the server in the last couple of months. I upgraded...
33
11842
by: JamesB | last post by:
I am writing a service that monitors when a particular app is started. Works, but I need to get the user who is currently logged in, and of course Environment.UserName returns the service logon (NT_AUTHORITY\SYSTEM). I understand that when the service starts, no user may be logged in, but that's ok, as the app I am monitoring can only be run by a logged in user. Do I need to use WMI to get the user context of Explorer.exe or is there a...
13
4061
by: Neil | last post by:
I'm using an Access MDB as a front end to a SQL 7 database. When I place the system time in a field in Access, it used the user's clock. I'd like to use the SQL Server system time, so that the times will be synchronized. I suppose I can just do a pass-through query with "select getdate()." But I was wondering if there was some built-in method, either in Access or SQL Server. I'm concerned about the overhead of running a pass-through query...
0
8483
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8825
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8605
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8676
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7445
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4227
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4416
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2819
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2062
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.