dbTalk Databases Forums  

How to get remote server datetime

microsoft.public.sqlserver.clients microsoft.public.sqlserver.clients


Discuss How to get remote server datetime in the microsoft.public.sqlserver.clients forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Ram
 
Posts: n/a

Default How to get remote server datetime - 04-27-2007 , 02:24 PM






Hi All ,
I have 3 sql servers located at different time zones. Say, CST,PST,EST.
Now how can I get current time at EST,PST from the SQL server located
at CST? Is there any query to do that?

I have a stored proc located in SQL server at CST zone where I need to
query for the current date/time of the other zone sql servers.

I tried below query at CST SQL server
SELECT TOP 1 GETDATE() FROM [SERVER-PST].master.dbo.syslocks

But it always gives CST datetime.

Please reply...

Thanks
RP


Reply With Quote
  #2  
Old   
Sue Hoegemeier
 
Posts: n/a

Default Re: How to get remote server datetime - 04-29-2007 , 06:36 PM






Haven't tested but it should work using Openquery instead of
the 4 part name. The statement passed in the openquery is
executed on the remote server.

-Sue

On Fri, 27 Apr 2007 12:24:01 -0700, Ram
<Ram (AT) discussions (DOT) microsoft.com> wrote:

Quote:
Hi All ,
I have 3 sql servers located at different time zones. Say, CST,PST,EST.
Now how can I get current time at EST,PST from the SQL server located
at CST? Is there any query to do that?

I have a stored proc located in SQL server at CST zone where I need to
query for the current date/time of the other zone sql servers.

I tried below query at CST SQL server
SELECT TOP 1 GETDATE() FROM [SERVER-PST].master.dbo.syslocks

But it always gives CST datetime.

Please reply...

Thanks
RP


Reply With Quote
  #3  
Old   
Ram
 
Posts: n/a

Default Re: How to get remote server datetime - 04-30-2007 , 10:24 AM



Hi Sue,
It works gr8....

Thanks for the help...


"Sue Hoegemeier" wrote:

Quote:
Haven't tested but it should work using Openquery instead of
the 4 part name. The statement passed in the openquery is
executed on the remote server.

-Sue

On Fri, 27 Apr 2007 12:24:01 -0700, Ram
Ram (AT) discussions (DOT) microsoft.com> wrote:

Hi All ,
I have 3 sql servers located at different time zones. Say, CST,PST,EST.
Now how can I get current time at EST,PST from the SQL server located
at CST? Is there any query to do that?

I have a stored proc located in SQL server at CST zone where I need to
query for the current date/time of the other zone sql servers.

I tried below query at CST SQL server
SELECT TOP 1 GETDATE() FROM [SERVER-PST].master.dbo.syslocks

But it always gives CST datetime.

Please reply...

Thanks
RP



Reply With Quote
  #4  
Old   
=?Utf-8?B?TmFtd2Fy?=
 
Posts: n/a

Default Re: How to get remote server datetime - 08-07-2007 , 10:40 AM



Hi,
Can you please write the exact syntax you used for Openquery? I also have
requirement similar to this.
Thanks for your help.
Namwar

"Ram" wrote:

Quote:
Hi Sue,
It works gr8....

Thanks for the help...


"Sue Hoegemeier" wrote:

Haven't tested but it should work using Openquery instead of
the 4 part name. The statement passed in the openquery is
executed on the remote server.

-Sue

On Fri, 27 Apr 2007 12:24:01 -0700, Ram
Ram (AT) discussions (DOT) microsoft.com> wrote:

Hi All ,
I have 3 sql servers located at different time zones. Say, CST,PST,EST.
Now how can I get current time at EST,PST from the SQL server located
at CST? Is there any query to do that?

I have a stored proc located in SQL server at CST zone where I need to
query for the current date/time of the other zone sql servers.

I tried below query at CST SQL server
SELECT TOP 1 GETDATE() FROM [SERVER-PST].master.dbo.syslocks

But it always gives CST datetime.

Please reply...

Thanks
RP



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.