当我执行这个查询时(只是长代码的一部分):
CREATE TABLE web_events
(
id integer,
account_id integer,
occurred_at datetime2,
channel varchar
);
INSERT INTO web_events VALUES (1, 1001, '2015-10-06 17:13:58', 'direct');
INSERT INTO web_events VALUES (2, 1001, '2015-11-05 03:08:26', 'direct');
INSERT INTO web_events VALUES (3, 1001, '2015-12-04 03:57:24', 'direct');
INSERT INTO web_events VALUES (4, 1001, '2016-01-02 00:55:03', 'direct');
我得到这个错误:
无法将显式值插入时间戳列。将 INSERT 与列列表一起使用以排除时间戳列,或将 DEFAULT 插入时间戳列。
除了
datetime2
之外,我还尝试过occurred_at
列的不同数据类型,如varbinary(8)
、datetime
、rowversion
。然而都导致了这个错误。