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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 datetime to offset

Author  Topic 

v.augnu
Starting Member

1 Post

Posted - 2009-07-13 : 03:44:27
We have an sql script to get audit logs generated thru sql. We are using SQL2005 Pro. Below is our script. Our problem is that in the Action Date column of the dbo.AuditEntry table, the time is always 4 hrs behind my server time (i.e. sql time 7/10/2009 2:51:48 PM, when it shoudl have been 7/10/2009 6:51:48 PM). How can i rectify this? Can someone modify my script so that the output time by SQL is same as my PC time.

CREATE TABLE AuditEntry (
ActionDate datetime NOT NULL,
UserName nvarchar(64) NOT NULL,
ComputerName nvarchar(64) NOT NULL,
Application nvarchar(64) NOT NULL,
Action nvarchar(64) NOT NULL,
ObjectName nvarchar(64),
Information nvarchar(1500),
Severity int NOT NULL,
VideoDestination int,
VideoDestinationType int,
ActionId int,
SourceIp int,
SequenceId int
);

waterduck
Aged Yak Warrior

982 Posts

Posted - 2009-07-13 : 04:10:03
will it posible you might use getutcdate() or getdate()??


Hope can help...but advise to wait pros with confirmation...
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-07-13 : 04:38:54
quote:
Our problem is that in the Action Date column of the dbo.AuditEntry table, the time is always 4 hrs behind my server time

Where is the ActionDate comes from ? Client's date time or using getdate() ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -