SQL Server 2016 和 2017,标准版
我需要将原始数据(来自另一个表)插入一个有两uniqueidentifier
列的表中。
这需要我使用SET IDENTITY_INSERT Carrier ON
吗?
这是表格:
SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
CREATE TABLE [dbo].[Parkingspace](
[ParkingspaceId] [uniqueidentifier] NOT NULL,
[AccountId] [uniqueidentifier] NULL,
[ParkingspaceType] [smallint] NULL,
CONSTRAINT [PK_ParkingspaceId] PRIMARY KEY CLUSTERED
(
[ParkingspaceId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON,
ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [PRIMARY]
) ON [PRIMARY]
如果没有该IDENTITY_INSERT
选项,以下内容是否有效?(我认为应该,但这里的 DBA 非常喜欢这个IDENTITY_INSERT
选项。)
INSERT INTO Parkingspace
(ParkingspaceID,AcountID,ParkingspaceType)
SELECT * FROM PRODDBCopy.Parkingspace