Reputation: 401
What am i missing?
create table Diver(
diver_number int primary key check(diver_number>0) not null,
first_name char(30) not null,
last_name char(30) not null,
fullname AS first_name+' '+last_name,
bithdate date not null,
email nchar(100) not null,
diver_password char(8) not null check(Len(diver_password) = 8
AND diver_password not like('%[^a-z0-9]%')),
diver_signature nchar(200) not null,
signature_date date not null,
old_diving_diaries nchar(200))
insert into Diver VALUES('1111','Dana','shwartz','1966/04/11','[email protected]','dana1234','http://www.google.co.il','')
I'm getting this error: Column name or number of supplied values does not match table definition. Why?
Upvotes: 2
Views: 13644
Reputation: 75
The number of values and data_types must be the same.
VALUES('1111','Dana','shwartz','1966/04/11','[email protected]','dana1234','http://www.google.co.il','ds2016','sdd1','odd1')
10 values needed to pass. Now it must run.
Upvotes: -1
Reputation: 1797
You miss old_diving_diaries. You need to chage the values to
VALUES('1111','Dana','shwartz','1966/04/11','[email protected]','dana1234','http://www.google.co.il','',
'') <-- this
You need only 9 data because of the computed column.
Upvotes: 1
Reputation: 2350
Yup, the error pretty much speaks for itself. You're trying to insert 8 values into a table with 10 columns.
Consider listing the column names you wish to insert into explicitly
insert into Diver (column names here)
VALUES('1111','Dana','shwartz','1966/04/11','[email protected]','dana1234','http://www.google.co.il','')
Upvotes: 2