Do Inserted Records Always Receive Contiguous Identity Values

前端 未结 5 1743
终归单人心
终归单人心 2020-12-06 14:16

Consider the following SQL:

CREATE TABLE Foo
(
    ID int IDENTITY(1,1),
    Data nvarchar(max)
)

INSERT INTO Foo (Data)
SELECT TOP 1000 Data
FROM SomeOther         


        
5条回答
  •  情深已故
    2020-12-06 14:52

    It is not good practice to attach any sort of meaning whatsoever to identity values. You should assume that they are nothing more than integers guaranteed to be unique within the scope of your table.

提交回复
热议问题