Friday, October 7, 2016

Error converting data type varchar to numeric

I was working on an ETL load and I come across below error when loading data from one table another table.

Error converting data type varchar to numeric

I see that the source table has data type VARCHAR and Target table has data type INTEGER

Source Table: Employee_X
EMPLOYEE_ID VARCHAR(50)
EMPLOYEE_NAME VARCHAR(50)
COSTCODE VARCHAR(50)

Target Table: Employee_Y
EMPLOYEE_ID INT
EMPLOYEE_NAME VARCHAR2 (50)
COSTCODE INT

I have used CAST function in the insert command and able to load data successfully

Insert into Employee_Y (EMPLOYEE_ID, EMPLOYEE_NAME, COSTCODE)
SELECT cast(EMPLOYEE _ID as INT) as EMPLOYEE_ID,
               EMPLOYEE_NAME,
               cast(COSTCODE as INT) as COSTCODE,
FROM Employee_X;

Regards
Satishbabu Gunukula


1 comment:

  1. As we decided that NextGen would be the right platform for us within the future , we chose to manually input the info into the new system. The NextGen system had added new data fields in places where there have been none in Medical Manager; these had to be filled in with the right info. So, the time saved by converting the info would are minimal as there was such a lot new info to be input, regardless. The time on this project was well-spent; we were ready to rotate all of our staff members through the training room to find out the new EPM system - meanwhile others called patients to verify demographic and get more about my Cheap Essay Writing Service insurance info as they confirmed appointments into the new system.

    ReplyDelete