sql 表无法插入,求解。
报错信息 Msg 8101, Level 16, State 1, Line 4
An explicit value for the identity column in table 'dbo.Vendors' can only be specified when a column list is used and IDENTITY_INSERT is ON.
表结构
CREATE TABLE [dbo].[Vendors](
[Id] [int] IDENTITY(1,1) NOT FOR REPLICATION NOT NULL,
[Name] [nvarchar](100) NOT NULL,
[EnglishName] [nvarchar](50) NOT NULL,
[Alias] [nvarchar](20) NULL,
[WorkLocation] [nvarchar](20) NOT NULL,
[Property] [nvarchar](50) NULL,
[Department] [nvarchar](50) NULL,
[IsNew] [nchar](1) NOT NULL,
[Title] [nvarchar](50) NULL,
[Report_To] [nvarchar](50) NULL,
[Serving] [nvarchar](50) NULL,
CONSTRAINT [PK_ChinaSoftVendors_1] PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
插入语句就是普通的 insert
[解决办法]
插入的时候不要插id就行了
[解决办法]
id 自增列 不能显式的插入值
把这个去掉
比如原来的
isnert into Vendors values(1,'name'...)
改成
isnert into Vendors values('name'...)