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)
无论我采用哪种方式,(数字或小数),或者如果我填写所有字段,我都会收到此错误:
算术溢出错误将数字转换为数据类型数字。
答案 0 :(得分:1)
你的表名与插入和选择查询不同,我很困惑为什么你也在做一个select语句,但试试这个:
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)