我想使我的數據備份從我的第一臺DocumentManagement.tbDocumentsHistory,並將其保存在DocumentManagement.tbDocuments標識列的顯式值?
而且由於DocumentManagement.tbDocuments有ID IDENTITY_INSERT欄這個錯誤會引發
表'DocumentManagement.tbDocuments'中的標識列的顯式值只能在使用列列表且IDENTITY_INSERT爲ON時指定。
當我用這個代碼
DELETE FROM DocumentManagement.tbDocumentsHistory
OUTPUT DELETED.* INTO DocumentManagement.tbDocuments
FROM DocumentManagement.tbDocumentsHistory
WHERE [email protected]
我試圖關閉IDENTITY_INSERT上DocumentManagement.tbDocuments使用此代碼
SET IDENTITY_INSERT DocumentManagement.tbDocuments ON
DELETE FROM DocumentManagement.tbDocumentsHistory
OUTPUT DELETED.* INTO DocumentManagement.tbDocuments
FROM DocumentManagement.tbDocumentsHistory
WHERE [email protected]
SET IDENTITY_INSERT DocumentManagement.tbDocuments OFF
,我仍然面臨着同樣的錯誤!
我的表說明:
CREATE TABLE [DocumentManagement].[tbDocuments](
[DocumentID] [bigint] IDENTITY(1,1) NOT NULL,
[DocumentNameEn] [nvarchar](max) NULL,
[DocumentNameAr] [nvarchar](max) NULL,
[DocumentDescriptionEn] [nvarchar](max) NULL,
[DocumentDescriptionAr] [nvarchar](max) NULL,
[CreatedOn] [datetime2](7) NULL,
[ModifiedOn] [datetime2](7) NULL,
[AddedBy] [bigint] NULL,
[modifaiedBy] [bigint] NULL,
[PhysicalName] [nvarchar](max) NULL,
[Extension] [nvarchar](15) NULL,
[DocumentTypeID] [bigint] NULL,
[PhysicalPath] [nvarchar](max) NULL,
CONSTRAINT [PK_tbDocuments] PRIMARY KEY CLUSTERED([DocumentID] ASC)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
)ON [PRIMARY]
CREATE TABLE [DocumentManagement].[tbDocumentsHistory](
[DocumentID] [bigint] NOT NULL,
[DocumentNameEn] [nvarchar](max) NULL,
[DocumentNameAr] [nvarchar](max) NULL,
[DocumentDescriptionEn] [nvarchar](max) NULL,
[DocumentDescriptionAr] [nvarchar](max) NULL,
[CreatedOn] [datetime2](7) NULL,
[ModifiedOn] [datetime2](7) NULL,
[AddedBy] [bigint] NULL,
[modifaiedBy] [bigint] NULL,
[PhysicalName] [nvarchar](max) NULL,
[Extension] [nvarchar](15) NULL,
[DocumentTypeID] [bigint] NULL,
[PhysicalPath] [nvarchar](max) NULL, CONSTRAINT [PK_tbDocumentsHistory] PRIMARY KEY CLUSTERED([DocumentID] ASC)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]) ON [PRIMARY]
使文檔名稱的nvarchar(max)。真的嗎? – 2012-03-11 08:52:30
它只是一個測試數據! – HAJJAJ 2012-03-11 09:02:31