You are viewing this site as a guest. You can still ask questions and help others! Join our Dev2Dev IT Community to receive your own blog, share your knowledge, and much more.

Regarding Inserting a new row into the table

7 replies [Last post]
peoplekishore's picture
User offline. Last seen 8 years 30 weeks ago. Offline
Joined: 05/13/2008
Posts: 11

Hi ,
I want to insert a new row into the position-data table with eff_status as inactive,with the same field values as before status is active.i have aroung 120 fields are ther in my record.how to fetch those 120 field values and insert a new row with effstatus as inactive.

sqlexec is not working with those many fields.

waiting for ur responce,
thanks in advance,
regards,
Kishore

pplsoftnerd's picture
pplsoftnerd (not verified)
Re: Regarding Inserting a new row into the table

create a SQL (File-> New-> SQL) object with following SQL command

"insert into table1 (name, effstatus, age) select field1, 'I', field2 from table1 where ....."

use SQLEXEC to invoke the SQL object wherever required in pplcode.

Jiju's picture
Jiju (not verified)
Re: Regarding Inserting a new row into the table

1. Create a CI on the Position Data component.
2. Write a simple insert SQL by querying the POSTION_DATA table.... insert into ps_position_data select position_nbr, effdt,eff_status....from ps_position_data where ....

peoplekishore's picture
User offline. Last seen 8 years 30 weeks ago. Offline
Joined: 05/13/2008
Posts: 11
Re: Regarding Inserting a new row into the table

IF I WILL DO THE SAME HOW CAN I CHANGE MY EFF_STATUS AS INACTIVE?

peoplekishore's picture
User offline. Last seen 8 years 30 weeks ago. Offline
Joined: 05/13/2008
Posts: 11
Re: Regarding Inserting a new row into the table

HI gUYS I RESOLVED IT
THANKS FOR UR EARLY RESPONCE.

Lepa's picture
User offline. Last seen 2 years 20 weeks ago. Offline
Joined: 06/23/2008
Posts: 591
Re: Regarding Inserting a new row into the table

peoplekishore, can you share with us how you were able to accomplish that?

Give back to the community and help it grow!
* Help with unanswered forum questions and issues
* Register or login to share your knowledge at your own blog

Guest's picture
Guest (not verified)
Re: Regarding Inserting a new row into the table

I CREATED AN SQL OBJECT AND USING GETSQL AND FETCH SQL I AM GETTING THE VALUES OF SELECTED FIELDS AND I CREATED ONE RECORD OBJECT AND I INSERTED A NEW ROW INTO IT WITH MODIFICATIONS.

Nitin's picture
User offline. Last seen 5 years 43 weeks ago. Offline
Joined: 06/30/2008
Posts: 73
Re: Regarding Inserting a new row into the table

I am pretty sure this can be acheived thru one single insert sql (set based).
The only problem is You cannot insert and select using same table.
It'll fail on DB2 and Informix.
so It'll be 2 step insertion.
Insert into some temp table and insert back using %insertselect and override the value of Eff Status.

Regards
Nitin