October 3, 2014 at 5:29 pm
CREATE PROCEDURE [dbo].[ELMAH_LogError]
(
@ErrorId UNIQUEIDENTIFIER,
@Application NVARCHAR(60),
@Host NVARCHAR(30),
@Type NVARCHAR(100),
@Source NVARCHAR(60),
@Message NVARCHAR(500),
@User NVARCHAR(50),
@AllXml NVARCHAR(MAX),
@StatusCode INT,
@TimeUtc DATETIME
)
AS
SET NOCOUNT ON
INSERT
INTO
[ELMAH_Error]
(
[ErrorId],
[Application],
[Host],
[Type],
[Source],
[Message],
[User],
[AllXml],
[StatusCode],
[TimeUtc]
)
VALUES
(
@ErrorId,
@Application,
@Host,
@Type,
@Source,
@Message,
@User,
@AllXml,
@StatusCode,
@TimeUtc
)
October 3, 2014 at 10:39 pm
Had this handy (straight from BOL);-) should get you passed the hurdle.
😎
/* Relevant date time functions with BOL comments*/
SELECT
/* Returns the current database system timestamp as a datetime
value. The database time zone offset is not included. This
value represents the current UTC time (Coordinated Universal
Time). This value is derived from the operating system of
the computer on which the instance of SQL Server is running */
GETUTCDATE() AS SYSTEM_UTC_DATE
/* Returns a datetime2(7) value that contains the date and time
of the computer on which the instance of SQL Server is
running. */
,SYSDATETIME() AS SYSTEM_TIME
/* Returns a datetimeoffset(7) value that contains the date and
time of the computer on which the instance of SQL Server is
running. The time zone offset is included. */
,SYSDATETIMEOFFSET() AS SYSTEM_TD_OFFSET
/* Returns a datetime2 value that contains the date and time of
the computer on which the instance of SQL Server is running.
The date and time is returned as UTC time (Coordinated
Universal Time). The fractional second precision
specification has a range from 1 to 7 digits. The default
precision is 7 digits. */
,SYSUTCDATETIME() AS SYS_UTC_DATETIME
/* Returns a datetimeoffset value that is translated from a
datetime2 expression. */
,TODATETIMEOFFSET(SYSDATETIME(),'-05:00') AS OFFSET_EST;
Results
SYSTEM_UTC_DATE SYSTEM_TIME SYSTEM_TD_OFFSET SYS_UTC_DATETIME OFFSET_EST
----------------------- --------------------------- ---------------------------------- --------------------------- ----------------------------------
2014-10-04 04:38:59.990 2014-10-04 05:38:59.9914360 2014-10-04 05:38:59.9914360 +01:00 2014-10-04 04:38:59.9914360 2014-10-04 05:38:59.9914360 -05:00
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply