Can unix timestamps contain the milliseconds value of the time?
If so, using SQL Server 2008 R2:
CREATE TABLE [dbo].[my_table_calls_log]
(
[id] [bigint] IDENTITY(1,1) NOT NULL,
[requestdate] [bigint] NULL,
[partycode] [bigint] NULL,
CONSTRAINT [PK_my_table_calls_log]
PRIMARY KEY CLUSTERED ([id] ASC)
)
The following select gives me the current date and time with milliseconds:
SELECT CONVERT(VARCHAR,SYSDATETIME(),121);
Example:
2015-09-11 13:29:02.8239061
How do I convert that long YYYY-MM-DD HH:MM:SS.MS date/time value into a unix timestamp so that I can insert it using something like:
DECLARE @UnixDate AS bigint;
SET @UnixDate = "the unix timestamp equivalent of SELECT CONVERT(VARCHAR,SYSDATETIME(),121);"
INSERT INTO my_table_calls_log (requestdate,partycode)
VALUES (@UnixDate,123);