Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Bekios
Starting Member
3 Posts |
Posted - 2014-08-28 : 06:22:31
|
Hello Everyone,Hope you are fine.I recently have added a field into table "Date Created", that has the Default Value or Binding GETDATE(). The problem is that when the insert is done to this table it is not getting Current Time, but the time is two hours forward. Example: Lets say that the time now is 13:20 and when insert is done to this table(default value, without sending value to this field) it is getting the time 15:20 . FYI: The insert is done throught a sql procedure that is executed from a program.Any idea why is this happening.Thanks for your answers in advance.Best Regards,B.C. |
|
jackv
Master Smack Fu Yak Hacker
2179 Posts |
Posted - 2014-08-28 : 07:47:04
|
the getdate() value comes from the operating system of the computer on SQL Server instance is running.Could you confirm the value on the OS?Jack Vamvas--------------------http://www.sqlserver-dba.com |
|
|
Bekios
Starting Member
3 Posts |
Posted - 2014-08-28 : 09:24:58
|
Hello Jack,Thanks for your response,Could you confirm the value on the OS?Can you explain me more how to find/confirm it?I don't understand what you asked me in this questions!Best Regards, |
|
|
gbritton
Master Smack Fu Yak Hacker
2780 Posts |
Posted - 2014-08-28 : 11:01:32
|
Open SSMS and any database. hit CTRL-N to start a new query. Type:select getdate() |
|
|
Bekios
Starting Member
3 Posts |
Posted - 2014-08-28 : 11:09:54
|
It Selects the correct Time, just when it is inserting from that program that executes the procedure it is inserting the wrong time, in this case two hours forward. |
|
|
gbritton
Master Smack Fu Yak Hacker
2780 Posts |
Posted - 2014-08-28 : 11:21:04
|
"when it is inserting from that program that executes the procedure it is inserting the wrong time"Please post the complete definition of the procedure called by the program that does the insert operation |
|
|
Bustaz Kool
Master Smack Fu Yak Hacker
1834 Posts |
Posted - 2014-08-28 : 18:50:43
|
Is the stored procedure supplying/generating the time or is it using the column's default? Is the default GETDATE() or GETUTCDATE()? Too often we enjoy the comfort of opinion without the discomfort of thought. - John F. Kennedy |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2014-08-29 : 02:53:23
|
Even if you have a column with a default value doesn't mean an application can insert another value.The default value is only stored if no value is supplied in the insert statement made by the application. Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA |
|
|
|
|
|
|
|