Rainhider
Rainhider

Reputation: 836

Error on table creation?

CREATE TABLE posEmployees
(
ID int IDENTITY(1,1) PRIMARY KEY,
LName varchar(55) NOT NULL,
FName varchar(55),
Dept varchar(20),
HourlyPay numeric(10, 2),
WeeklyHours numeric(5, 2),
IsManager bit, 
Salary numeric(9,2), 
HireFire bit
)

select * from POS_EMPLOYEES

 insert into POS_EMPLOYEES (LName, FName, Dept, HourlyPay, WeeklyHours)
values ('Pride', 'Kitty', 'Sales', 5.5, 20.0)

No matter which way I do it, (numeric or decimal) or if I fill all fields in or not, I get this error:

Arithmetic overflow error converting numeric to data type numeric.

Upvotes: 0

Views: 82

Answers (1)

realtek
realtek

Reputation: 841

Your table name is different to the insert and select queries, i'm confused why you are doing a select statement too but try this:

CREATE TABLE posEmployees
(
ID int IDENTITY(1,1) PRIMARY KEY,
LName varchar(55) NOT NULL,
FName varchar(55),
Dept varchar(20),
HourlyPay numeric(10, 2),
WeeklyHours numeric(5, 2),
IsManager bit, 
Salary numeric(9,2), 
HireFire bit
)

 insert into posEmployees(LName, FName, Dept, HourlyPay, WeeklyHours)
values ('Pride', 'Kitty', 'Sales', 5.5, 20.0)

Upvotes: 1

Related Questions