Hi
i want to copy a row and insert that same values in different/same table..
for example
Empno LunchAllovance
1001 50
1002 50
here lunch allovance is 50 for all the employees. i want to copy that and paste as a new record for a new employee. The employee number should be changed.... can anyone help me in this please
Thanks
Hi,
1: If the lunchAllowance is same for all the employees then you can set a default value to this column and exclude this column from the insert statement.
2: You can insert all the other column(s) in the table except the LunchAllowance. The insert statement should be followed by an UPDATE statement which looks somehing like the following:
-
UPDATE EMPLOYEE
-
SET LunchAllowance= SELECT DISTINCT(LunchAllowance)
-
FROM EMPLOYEE
-
WHERE Empno=<empno_recently_inserted>
-
I hope this answers your question.
Regards,
Pradeep