سؤال

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