I got a table EMPLOYEE1 and i'm trying to insert values into it

INSERT INTO EMPLOYEE1 values(00001, 00004566)

But it inserts the values as 1 and 4566 truncating zero's why does this happen. can some one help me out

有帮助吗?

解决方案

This is happening because the data type of this column is numeric. You should make these columns varchar to be able to insert numbers without trancating zeros. Something like:

CREATE TABLE Employee1(EmpNumber VARCHAR(50), EmpName VARCHAR(50), ...);

INSERT INTO Employee1 VALUES
('00001', 'Foo', ..);
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top