November 23, 2012 at 6:35 am
create table class
(classid int primary key identity,
classname varchar(30) not null unique,
studid int foreign key references student(studid))
-------- insert query
insert into class
(classid,classname,studid)
values
('secondstd',2)
----- query error
Msg 109, Level 15, State 1, Line 1
There are more columns in the INSERT statement than values specified in the VALUES clause. The number of values in the VALUES clause must match the number of columns specified in the INSERT statement.
November 23, 2012 at 6:42 am
Your statement says that you want to enter data into 3 columns, but you are only providing data for 2 columns.
Because you are using an IDENTITY, then you don't need to mention this.
So...
insert into class
(classname,studid)
values ('secondstd',2)
November 23, 2012 at 6:49 am
Thanks lot...
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply