Monday, June 7, 2010

Copy column from one table to other table

------------------------
EMPLOYEE TABLE
------------------------
salCodeid name
------------------------



---------------------------------------------
SALARY TABLE
----------------------------------------------
idsalCode salary basic tax bonus
---------------------------------------------



Column exists in target table then

INSERT INTO EMPLOYEE (salCodeid) SELECT idsalCode FROM SALARY

If column does not exixts

ALTER EMPLOYEE (salCodeid) SELECT idsalCode FROM SALARY

No comments: