从SQL Server获取系统时间 [英] Getting System Time From SQL Server

查看:70
本文介绍了从SQL Server获取系统时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Access MDB作为SQL 7数据库的前端。当我将

系统时间放在Access中的一个字段中时,它使用了用户的时钟。我想使用

SQL Server系统时间,以便时间同步。我想b $ b假设我可以使用select getdate()进行传递查询。但我想知道是否有一些内置方法,无论是在Access还是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.

推荐答案

Neil(no****@nospam.net)写道:
Neil (no****@nospam.net) writes:

我是使用Access MDB作为SQL 7数据库的前端。当我在Access中的字段中放置系统时间时,它使用了用户的时钟。我想

使用SQL Server系统时间,这样时间将是

同步。我想我可以使用select

getdate()进行传递查询。但我想知道是否有一些内置方法,

在Access或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.



你想要服务器上的时间,SELECT getdate()这可能是

最简单的方法。但是你当然可以做一个远程程序在SQL Server外面调用
作为Windows编程中的一个小练习

如果你愿意的话。但是,我看不出那是值得的痛苦。

-

Erland Sommarskog,SQL Server MVP, es **** @ sommarskog.se


SQL Server 2005联机丛书
http://www.microsoft.com/technet/pro .. .ads / books.mspx

SQL Server 2000联机丛书
http://www.microsoft.com/sql/prodinf...ons/books.mspx

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****@sommarskog.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




" Erland Sommarskog" < es **** @ sommarskog.sewrote in message

news:Xn ********************** @ 127.0.0.1 ...

"Erland Sommarskog" <es****@sommarskog.sewrote in message
news:Xn**********************@127.0.0.1...

Neil(no****@nospam.net)写道:
Neil (no****@nospam.net) writes:

> ;我正在使用Access MDB作为SQL 7数据库的前端。当我将系统时间放在Access中的字段中时,它使用了用户的时钟。我希望
使用SQL Server系统时间,以便时间同步。我想我可以使用select
getdate()进行传递查询。但我想知道是否有一些内置的方法,
在Access或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.



你想要服务器上的时间,SELECT getdate()这可能是

最简单的方法。但是你当然可以做一个远程程序在SQL Server外面调用
作为Windows编程中的一个小练习

如果你愿意的话。但是,我看不出那些值得痛苦的事情。


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.


" Neil" < no **** @ nospam.netwrote:
"Neil" <no****@nospam.netwrote:

>我正在使用Access MDB作为SQL 7数据库的前端。当我将
系统时间放在Access中的一个字段中时,它使用了用户的时钟。我想使用SQL Server系统时间,以便时间同步。我想我可以使用select getdate()进行传递查询。但我想知道是否有一些内置方法,无论是在Access还是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.



在公司网络中,每个人都应该使用共同的时间源。


Tony

-

Tony Toews,Microsoft Access MVP

请仅在新闻组中回复,以便其他人可以阅读整个消息主页。 br />
Microsoft Access Links,Hints,Tips&会计系统
http://www.granite.ab.ca /accsmstr.htm

Tony的Microsoft Access博客 - http://msmvps.com/blogs/access/


这篇关于从SQL Server获取系统时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆