我不确定这是不是一个问题。我在我的一个应用程序上使用simple.data。我查看了表格中的记录。我看到ID从1,2,3,5,5跳到10002,10003 ...... 10041,再次跳到20018 ... 20028。
我注意到那些在同一天插入的记录,如果不是同一天,它们的ID仅增加1.将增加10000。
我在github上问了这个问题。得到确认这不是Simple.Data问题。更像是sql server问题。
这不会是Simple.Data正在做的事情。听起来像那里 可能是复制设置IDENTITY范围分配新范围 每一天,或者其他什么。但Simple.Data不会尝试生成ID 所有,所以问题出在其他地方。
如何查看IDENTITY范围?
我检查了身份规范: 身份增量:1 身份种子:1
btw,ID数据类型是BigInt
答案 0 :(得分:0)
看起来你有一些工作(任务)通过在一天结束时添加10000来执行表的标识列的重新设定。这可以通过以下脚本完成(ex):
if object_id('tempdb..#t') is not null drop table #t
create table #t (id int identity(1,1), val int)
insert into #t select 1
insert into #t select 2
insert into #t select 3
select * from #t
dbcc checkident ('#t')
declare @x bigint
set @x = ident_current('#t')
select @x = floor((@x + 10000)/ 10000) * 10000
dbcc checkident ('#t', reseed, @x)
insert into #t select 1
insert into #t select 2
insert into #t select 3
select * from #t
上述查询的结果显示在以下屏幕截图中: