盡管你可以對標識列(identity column)的值及其任意值的用處有千條萬條理由
為了解決這個問題
CREATE TABLE TestIdentityGaps
(
ID int IDENTITY PRIMARY KEY
Description varchar(
)
GO
INSERT [INTO] TestIdentityGaps (Description) VALUES (
INSERT [INTO] TestIdentityGaps (Description) VALUES (
INSERT [INTO] TestIdentityGaps (Description) VALUES (
INSERT [INTO] TestIdentityGaps (Description) VALUES (
INSERT [INTO] TestIdentityGaps (Description) VALUES (
INSERT [INTO] TestIdentityGaps (Description) VALUES (
GO
現在
DELETE TestIdentityGaps
WHERE Description IN(
在我們編寫代碼的時候
INSERT [INTO] TestIdentityGaps (Description) VALUES (
INSERT [INTO] TestIdentityGaps (Description) VALUES (
GO
SELECT * FROM TestIdentityGaps
你也無法明確地設置標識列的值
INSERT INTO TestIdentityGaps (id
GO
為了解決這個問題
SET TestIdentityGapsON
INSERT INTO TestIdentityGaps (id
INSERT INTO TestIdentityGaps (id
GO
SELECT * FROM TestIdentityGaps
現在你可以看到新的數據行已經用指定的主關鍵字值插入了
注意
你可以在一個帶有標識列的表格裡插入一個具體的值
From:http://tw.wingwit.com/Article/program/Oracle/201311/17183.html