Quantcast
Channel: Forum Getting started with SQL Server
Viewing all articles
Browse latest Browse all 4729

need help understanding what i am doing wrong in my insert statement

$
0
0

insert into employees (employeeid, firstname, lastname, title) Values ('1001', 'jack', null, 'shepard', 'salesperson');
insert into employees (employeeid, firstname, lastname, title) Values ('1002', 'jack', null, 'shepard', 'salesperson');
insert into employees (employeeid, firstname, lastname, title) Values ('1003', 'jack', null, 'shepard', 'salesperson');
insert into employees (employeeid, firstname, lastname, title) Values ('1004', 'jack', null, 'shepard', 'salesperson');
insert into employees (employeeid, firstname, lastname, title) Values ('1005', 'jack', null, 'shepard', 'salesperson');
insert into employees (employeeid, firstname, lastname, title) Values ('1006', 'jack', null, 'shepard', 'salesperson');

i am getting this error message

Msg 110, Level 15, State 1, Line 3
There are fewer 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.

also 

insert into products (Name, price) values  ('shirts', 12.99);
insert into products (Name, price) values  ('shirts', 14.99);
insert into products (Name, price) values  ('shirts', 11.99);
insert into products (Name, price) values  ('shirts', 14.99);
insert into products (Name, price) values  ('shirts', 13.99);
insert into products (Name, price) values  ('shirts', 15.99);
insert into products (Name, price) values  ('shirts', 16.99);

Msg 515, Level 16, State 2, Line 2
Cannot insert the value NULL into column 'ProductID', table 'practice.dbo.products'; column does not allow nulls. INSERT fails.
The statement has been terminated.

what am i doing wrong?


Viewing all articles
Browse latest Browse all 4729

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>