Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2005 > SQL Server 2005
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
SQL Server 2005 General discussion of SQL Server *2005* version only.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2005 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 18th, 2007, 04:05 PM
Friend of Wrox
 
Join Date: Apr 2006
Location: , , .
Posts: 160
Thanks: 0
Thanked 0 Times in 0 Posts
Default time in sql server is not real time

Hi,

when i create a new user in a .MDF file, the hour of creation in the field
"createdate" of table "membership" is exactly 2 hours less than the time of
my computer. Probably something to do with different hours between Europe
and UK or ...

How can i set the creation hour to exact the same hour of my computer?

Thanks
Dan


Reply With Quote
  #2 (permalink)  
Old April 18th, 2007, 11:55 PM
Friend of Wrox
 
Join Date: May 2006
Location: Helsingborg, , Sweden.
Posts: 246
Thanks: 0
Thanked 0 Times in 0 Posts
Default

UK is not resided in Europe? ;)

Look at the code. Are you using CURRENT_TIMESTAMP, GETDATE() or any UTC-related function?


Reply With Quote
  #3 (permalink)  
Old April 19th, 2007, 02:12 AM
Friend of Wrox
 
Join Date: Apr 2006
Location: , , .
Posts: 160
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi, thanks for replying

I meant: UK is not part of the continent ... and there is a difference of two hours between UK and the continent.

I don't use any function. The user is created using asp.net control CreateUserWizard. The user enters his name, password etc ... and it's done.

Reply With Quote
  #4 (permalink)  
Old April 19th, 2007, 05:02 AM
Friend of Wrox
 
Join Date: May 2006
Location: Helsingborg, , Sweden.
Posts: 246
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Which component is writing the CREATEDATE column then?
The SQL Server get it's date and time from the server on which it is installed.
Your computer may have different settings.


Reply With Quote
  #5 (permalink)  
Old April 19th, 2007, 07:03 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Is the Column set a default value at the DB level, or is that sent from the .net application? If sent from the .net application then the time settings (2 hours lag) of the application system might be different from what the DB server has.

Have check on that.
Cheers.

_________________________
- Vijay G
Strive for Perfection
Reply With Quote
  #6 (permalink)  
Old April 19th, 2007, 07:03 AM
Friend of Wrox
 
Join Date: Apr 2006
Location: , , .
Posts: 160
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The test i did (creating an user in sql server via asp.net) happened on the computer with Sql server. The settings (region, language) of that computer are correct because the clock and date are correct on my screen.
I still don't understand why sql server doesn't use that date /time and wonder which setting it uses.

Reply With Quote
  #7 (permalink)  
Old April 19th, 2007, 07:07 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

What does "select getdate()" return on the sql server? Is there a lag of 2 hours in that? If there is a lag you might want to fix it at the sql server computer.
Otherwise...
Why dont you try setting default value for that column in the sql server and see if that helps. Then you might remove the code that sets user creation date from the application.

_________________________
- Vijay G
Strive for Perfection
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Real time data from network Nuwang .NET Framework 2.0 1 May 13th, 2008 04:34 PM
Real Time Application of Void class pandian Java Basics 0 October 9th, 2006 05:36 PM
real time updation on a offline database. deadman ADO.NET 3 April 17th, 2006 04:29 PM
Real Time Calculations on Form losartan Access 10 February 10th, 2005 11:47 AM
real time calculations jman11587 Javascript How-To 4 June 29th, 2003 07:15 PM



All times are GMT -4. The time now is 08:07 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.