I have a table with an IDENTITY column and a DateTime column set by GetDate () as follows:
CREATE TABLE [MyTable]( [Id] [int] IDENTITY(1,1) , [InsertTime] [datetime] DEFAULT (getdate()), [OtherValues] [int] )
All INSERTs have default values for IDENTITY and DateTime columns as follows:
INSERT INTO [MyTable] ([OtherValues]) VALUES (1)
always as standalone statements outside of any explicit transaction.
I would expect that Id will strictly increase, and InsertTime will also increase, but not strictly. But with a lot of work, we see several such examples:
| Id | InsertTime | |------|-------------------------| | 3740 | 2015-03-05 10:07:25.560 | | 3741 | 2015-03-05 10:07:25.557 | | 3742 | 2015-03-05 10:07:25.577 |
where we have a slight drop in InsertTime.
Does anyone know how this happens and what is the “correct” line order?
source share