Row by row update
<<stop posting your interview questions>>
Hi
The below select statement is taking too much time in Production system,
is there any way to optimize the above code ?
"select * from VVBAP
into g_wa_vvbap
where vbeln in g_vbeln.
g_wa_vvbap-zmeng = g_wa_vvbap-zmeng + 5.
update vvbap from g_wa_vvbap.
Endselect."
Sandeep
Edited by: Matt on Dec 21, 2009 2:10 PM
Hi Thomas,
Reading this was a real treat
The code is below, not above. For you, that is. For me, it is above, not below. Hope you understand.
My experience ..
I searched for the answer so that i may be the early bird to post the answer,on this thread..and win some good points on this thread...
O Lock
I felt bad that day that in spite of my efforts, Sandeep gave 10 points to Subin.
Now i see it all
Am feeling a looooooooooottttttttt better now.
Sandeep,Subin,Vicky... lesson to be learnt
Regards,
SuryaD.
Similar Messages
-
How can i use multiple row subquery in update statement
Hai All
I using group function in my update statement.. and i need to update more rows so i need to use multiple row
subquery pls tell me how to use multiple row subquery in update statement
For example
while i am using this like this i got an error
update dail_att set outtime in (select max(r2.ptime) from temp_att where empcode=r2.enpno and
barcode=r2.cardn and attend_date=r2.pdate group by enpno,pdate,cardn);
Pls tell me how to use with example
Thanks & regards
Srikkanth.MHai Man
Thanks for ur response Let me clear what i need
First step Fetch the records as text file and stores into table T1
and the next step is i have seperated the text using substring and stores in different columns of a table
There are two shifts 0815 to 1645 and 1200 and 2000
Here I rep IN and O rep OUT
Empno date time inout
001 01-01-10 0815 I
002 01-01-10 0815 I
003 01-01-10 0818 I
001 01-01-10 1100 0
001 01-01-10 1130 I
002 01-01-10 1145 0
002 01-01-10 1215 I
004 01-01-10 1200 I
005 01-01-10 1215 I
004 01-01-10 1315 O
004 01-01-10 1345 I
001 01-01-10 1645 0
002 01-01-10 1715 0
003 01-01-10 1718 0
004 01-01-10 2010 0
005 01-01-10 2015 0
This is my T1 table i have taken data from text file and stored in this table from this table i need to move data to another table T2
T2 contains like this
Empno Intime Intrin Introut Outtime Date
001 0815 1100 1130 1645 01-01-10
002 0815 1145 1215 1715 01-01-10
003 0818 1718 01-01-10
004 1200 1315 1345 2010 01-01-10
005 1215 2015 01-01-10
This what i am trying to do man but i have little bit problems Pls give some solution with good example
And my coding is
declare
emp_code varchar2(25);
in_time varchar2(25);
out_time varchar2(25);
Cursor P1 is
Select REASON,ECODE,READMODE,EMPD,ENPNO,FILL,PDATE,PTIME,INOUT,CARDN,READERN
From temp_att
group by REASON,ECODE,READMODE,EMPD,ENPNO,FILL,PDATE,PTIME,INOUT,CARDN,READERN
ORDER BY enpno,pdate,ptime;
begin
for r2 in p1 loop
declare
bar_code varchar2(25);
begin
select barcode into bar_code from dail_att where empcode=r2.enpno and attend_date=r2.pdate;
For r3 in (select empcode,empname,barcode,intime,intrin,introut,addin,addout,outtime,attend_date from dail_att)loop
if r2.inout ='O' then
update dail_att set outtime =(select max(r2.ptime) from temp_att where empcode=r2.enpno and barcode=r2.cardn and attend_date=r2.pdate group by r2.cardn,r2.enpno,r2.pdate );
end if;
end loop;
exception
when no_data_found then
if r2.inout ='I' then
insert into dail_att(barcode,empcode,intime,attend_date)(select r2.cardn,r2.enpno,min(r2.ptime),r2.pdate from temp_att group by r2.cardn,r2.enpno,r2.pdate );
end if;
end;
end loop;
commit;
end;
Pls tell me what correction i need to do i the update statement i have used a subquery with group function but when i used it will return only one row but my need is to return many rows and i need to use multiple row subquery
and how can i use it in the update statement
Thanks In Advance
Srikkanth.M -
How can I use multiple row insert or update into DB in JSP?
Hi all,
pls help for my question.
"How can I use multiple rows insert or update into DB in JSP?"
I mean I will insert or update the multiple records like grid component. All the data I enter will go into the DB.
With thanks,That isn't true. Different SQL databases have
different capabilities and use different syntax, That's true - every database has its own quirks and extensions. No disagreement there. But they all follow ANSI SQL for CRUD operations. Since the OP said they wanted to do INSERTs and UPDATEs in batches, I assumed that ANSI SQL was sufficient.
I'd argue that it's best to use ANSI SQL as much as possible, especially if you want your JDBC code to be portable between databases.
and there are also a lot of different ways of talking to
SQL databases that are possible in JSP, from using
plain old java.sql.* in scriptlets to using the
jstlsql taglib. I've done maintenance on both, and
they are as different as night and day.Right, because you don't maintain JSP and Java classes the same way. No news there. Both java.sql and JSTL sql taglib are both based on SQL and JDBC. Same difference, except that one uses tags and the other doesn't. Both are Java JDBC code in the end.
Well, sure. As long as you only want to update rows
with the same value in column 2. I had the impression
he wanted to update a whole table. If he only meant
update all rows with the same value in a given column
with the same value, that's trivial. All updates do
that. But as far as I know there's know way to update
more than one row where the values are different.I used this as an example to demonstrate that it's possible to UPDATE more than one row at a time. If I have 1,000 rows, and each one is a separate UPDATE statement that's unique from all the others, I guess I'd have to write 1,000 UPDATE statements. It's possible to have them all either succeed or fail as a single unit of work. I'm pointing out transaction, because they weren't coming up in the discussion.
Unless you're using MySQL, for instance. I only have
experience with MySQL and M$ SQL Server, so I don't
know what PostgreSQL, Oracle, Sybase, DB2 and all the
rest are capable of, but I know for sure that MySQL
can insert multiple rows while SQL Server can't (or at
least I've never seen the syntax for doing it if it
does).Right, but this syntax seems to be specific to MySQL The moment you use it, you're locked into MySQL. There are other ways to accomplish the same thing with ANSI SQL.
Don't assume that all SQL databases are the same.
They're not, and it can really screw you up badly if
you assume you can deploy a project you've developed
with one database in an environment where you have to
use a different one. Even different versions of the
same database can have huge differences. I recommend
you get a copy of the O'Reilly book, SQL in a
Nutshell. It covers the most common DBMSes and does a
good job of pointing out the differences.Yes, I understand that.
It's funny that you're telling me not to assume that all SQL databases are the same. You're the one who's proposing that the OP use a MySQL-specific extension.
I haven't looked at the MySQL docs to find out how the syntax you're suggesting works. What if one value set INSERT succeeds and the next one fails? Does MySQL roll back the successful INSERT? Is the unit of work under the JDBC driver's control with autoCommit?
The OP is free to follow your suggestion. I'm pointing out that there are transactions for units of work and ANSI SQL ways to accomplish the same thing. -
To find out the last row that is updated in a View Object
Hi OAF Gurus,
I have requirement like,
I have to find out the last row that is updated on a particular View Object and I have send a mail to the users about the change.
JegSAMassMobVOImpl vo = getJegSAMassMobVO1();
JegSAMassMobVO is the View Object Name and it displays certain rows that has already been added to the VO in the Page.
Now the issue is when a user updates a particular row,I have to find which row gets updated and have to send a email to that particular employee about the change.
Just want to know,how to find out the last updated row in a particular VO.
Any Help would be appreciated as this a immediate requirement.
Regards,
Magesh.M.K.
Edited by: user1393742 on May 4, 2011 1:06 AMHi Magesh
It shoud be a Advanced table ,so when user will update the row ,the specific row will fire the PPR and on that event u can capture the row using row reference ,this is the sample code below
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
super.processFormRequest(pageContext, webBean); OAApplicationModule am =
(OAApplicationModule)pageContext.getApplicationModule(webBean);
String event = pageContext.getParameter("event");
if ("<ItemPPREventName>").equals(event))
// Get the identifier of the PPR event source row
String rowReference =
pageContext.getParameter(OAWebBeanConstants.EVENT_SOURCE_ROW_REFERENCE);
Serializable[] parameters = { rowReference };
// Pass the rowReference to a "handler" method in the application module.
262
am.invokeMethod("<handleSomeEvent>", parameters);
In your application module's "handler" method, add the following code to access the source row:
OARow row = (OARow)findRowByRef(rowReference);
if (row != null)
Thanks
Pratap -
How to update row by row in Jdbc Adapter sender ?
Hi friends ,
No i am reading data from a table using select query and resulting data i am keeping in the FTP folder as XML File.
I want to
1. to know how many rows i read ?
2. Update the read completed time in each row of the sender side table .
( I am using <b>select * from a table where tag='n' </b> . I am giving this in <b>Query SQL Statement</b> of JDBC Sender adapter processing parameter .
I am writing update query as update table set tag='y' where tag='n' .
Will it perform row by row ?
3. Insert in to another R3 System table the rows which i read as a log .
Can you please give procedure to do that .
Expecting your reply asap .
Thank you
Best Regards.,
V.RangarajanHi raj ,
Thanks for ur reply . I am new to xi . Just i am doing a scenario . I can able to read the ms-sql server table data using jdbc Sender adapter .
Can i use RFC Adapter to insert the values to R3 table ?
If i have mapped to rfc fields will it store into the table once we read the data from ms_sql server table using select query of JDBC Sender Adapter ?
Best Regards
V.Rangarajan -
How to count the number of Rows to be Updated before Update takes place..
Hi all,
I have a requirement, where i have to count the number of rows to be updated before updating it. SQL%ROWCOUNT gives the no. of rows updated ( after update takes place). How do i get to know the count of no. of rows to be updated/inserted/ deleted. I was looking for a simple solution, as above SQL%Rowcount. But i couldn't find any. I can use a Function and Return the value which will give me number of rows to be updated, But is there any Simple Logic other than this.. or any count function. Your Help is Appreciated. Thanks!If you really want to do this (I have no clue why you would need it), then you can piggy back on any existing pessimistic locking you may already have in place.
However, it would require two loops through the records of which you want to know the count before you update, and a second pass to update them.
I would really re-think the need for this, though.
SQL> create table t0304(c number);
Table created.
SQL> insert into t0304 select rownum from all_objects where rownum <= 10;
10 rows created.
SQL> commit;
Commit complete.
SQL> select * from t0304;
C
1
2
3
4
5
6
7
8
9
10
10 rows selected.
SQL> declare
2 cursor mycursor is select * from t0304 where mod(c,2) = 0 for update;
3 i number := 0;
4 begin
5 for r in mycursor loop
6 i := i + 1;
7 end loop;
8 dbms_output.put_line(i);
9 for r in mycursor loop
10 update t0304 set c = c + 20 where current of mycursor;
11 end loop;
12 end;
13 /
5
PL/SQL procedure successfully completed.
SQL> commit;
Commit complete.
SQL> select * from t0304;
C
1
22
3
24
5
26
7
28
9
30
10 rows selected.
SQL>Edited by: Steve Howard on Mar 4, 2011 5:57 PM -
How to count updated rows after an UPDATE?
Is there a way to count updated rows after an update?
Let's say I have an update like
UPDATE table_a
set field_1 = 'new_field'
WHERE field_2 ='some_value' ;
And now I would like to insert an info record into logging table like
INSERT INTO logging_tbl (step, description, changed_rows) VALUES('UPDATE', 'update of table_a', ?);
update is in sqlplus script.
Thanks.
Message was edited by:
br00klynZ00Use SQL%ROWCOUNT.
DECLARE
v_num NUMBER := 0;
BEGIN
UPDATE table_a
set field_1 = 'new_field'
WHERE field_2 ='some_value' ;
v_num := SQL%ROWCOUNT;
INSERT INTO logging_tbl (step, description, changed_rows)
VALUES('UPDATE', 'update of table_a', v_num);
END; -
Count of updated rows after an UPDATE command
Hi, is there any way to know how many rows have been updated after an UPDATE statement in a PL/SQL program (i know it is possible in Pro*C. Thanks.
Hi,
it will be stored in sql%rowcount
after your update statement try to assign this to a variable
Update table set ....
v_count := sql%rowcount;
check the value of the variable v_count
Thanks
Ravi -
TS1042 what happened to "front row" when I updated to OS X Lion?
what happened to "front row" when I updated to OS X Lion?
Lion doesnt have it anymore. When Mountain Lion comes out on July 25, it will have front row again!
-
Mutating error : row level BEFORE UPDATE trigger
Hi,
I had an issue on mutating terror(was trying to write a row level BEFORE update trigger), however i got it resolved after refering tom kytes web site. I thought i would share it with everyone, might be helpful for a few... Thanks!
I will be more than happy to learn on further better ways of resolving this issue.
Below I have posted the trigger that was causing this error and the work around for that issue, I created a package and three other triggers to replace row level BEFORE update trigger:
++trigger that was causing this issue:++
CREATE OR REPLACE TRIGGER C_F_BI
BEFORE INSERT ON CONTACT_FUNCTION FOR EACH ROW
declare
cursor function_code_cur ( cur_contact_id CONTACT.Contact_Id%type,
cur_function_type_code CONTACT_FUNCTION.Function_Type_Code%type)
is
select
cft.function_type_code,
cft.multiples_permitted
from
CONTACT_FUNCTION cf,
CONTACT c,
CONTACT_FUNCTION_TYPE cft
where
c.acct_id = (select acct_id from contact where contact_id = cur_contact_id)
and c.contact_id = cf.contact_id
and cf.function_type_code = cft.function_type_code
and cft.function_type_code = cur_function_type_code;
v_function_type_code contact_function_type.function_type_code%type;
v_multiples_permitted contact_function_type.multiples_permitted%type;
E_Multiples_Not_Permitted Exception;
begin
if not function_code_cur%isopen then
open function_code_cur(:new.contact_Id,:new.function_type_code);
end if;
loop
fetch function_code_cur into v_function_type_code, v_multiples_permitted;
exit when not function_code_cur%found;
end loop;
** if the fetch returns a v_multiples_permitted of 'Y' or no record is found, then it is
** ok to add the record. Otherwise raise an error because that function_type is already
** being used at the current acct.
if v_multiples_permitted = 'N' then
raise E_Multiples_Not_Permitted;
end if;
close function_code_cur;
EXCEPTION
when E_Multiples_Not_Permitted then
raise_application_error( -20001,'Multiples not allowed for function type ' ||
v_function_type_code || '. sqlerrm - ' || sqlerrm );
when others then
raise;
end;
++solution for above issue :++
create or replace package state_pkg
is
type ridArray_rec is record(rid rowid, cont_id number, cont_fn_type varchar2(20));
type ridArray is table of ridArray_rec index by binary_integer;
newRows ridArray;
empty ridArray;
end state_pkg;
create or replace trigger contact_function_bu1
before update on contact_function
begin
state_pkg.newRows := state_pkg.empty;
end;
create or replace trigger contact_function_bu2
before update ON CONTACT_FUNCTION FOR EACH ROW
DECLARE
I NUMBER:=0;
begin
I := state_pkg.newRows.count+1;
state_pkg.newRows( I ).rid := :new.rowid;
state_pkg.newRows( I ).cont_id := :new.contact_id;
state_pkg.newRows( I ).cont_fn_type := :new.function_type_code;
end;
create or replace trigger contact_function_bu
after update ON CONTACT_FUNCTION
declare
cursor function_code_cur ( cur_contact_id CONTACT.Contact_Id%type,
cur_function_type_code CONTACT_FUNCTION.Function_Type_Code%type,
rid2 rowid)
is
select
cft.function_type_code,
cft.multiples_permitted
from
CONTACT_FUNCTION cf,
CONTACT c,
CONTACT_FUNCTION_TYPE cft
where
c.acct_id = (select acct_id from contact where contact_id = cur_contact_id)
and c.contact_id = cf.contact_id
and cf.function_type_code = cft.function_type_code
and cft.function_type_code = cur_function_type_code
and cf.rowid = rid2;
v_function_type_code contact_function_type.function_type_code%type;
v_multiples_permitted contact_function_type.multiples_permitted%type;
E_Multiples_Not_Permitted Exception;
begin
for i in 1 .. state_pkg.newRows.count loop
if not function_code_cur%isopen then
open function_code_cur(state_pkg.newRows(i).cont_id, state_pkg.newRows(i).cont_fn_type, state_pkg.newRows(i).rid);
end if;
loop
fetch function_code_cur into v_function_type_code, v_multiples_permitted;
exit when not function_code_cur%found;
end loop;
** if the fetch returns a v_multiples_permitted of 'Y' or no record is found, then it is
** ok to add the record. Otherwise raise an error because that function_type is already
** being used at the current acct.
if v_multiples_permitted = 'N' then
raise E_Multiples_Not_Permitted;
end if;
close function_code_cur;
end loop;
EXCEPTION
when E_Multiples_Not_Permitted then
raise_application_error( -20001,'Multiples not allowed for function type ' ||
v_function_type_code || '. sqlerrm - ' || sqlerrm );
when others then
raise;
end;
/It seems you could have solved the issue otherwise:
CREATE OR REPLACE TRIGGER c_f_bi
BEFORE INSERT
ON contact_function
FOR EACH ROW
DECLARE
v_function_type_code contact_function_type.function_type_code%TYPE;
v_multiples_permitted contact_function_type.multiples_permitted%TYPE;
e_multiples_not_permitted EXCEPTION;
BEGIN
BEGIN
SELECT cft.function_type_code, cft.multiples_permitted
INTO v_function_type_code, v_multiples_permitted
FROM contact c, contact_function_type cft
WHERE c.acct_id = (SELECT acct_id
FROM contact
WHERE contact_id = :NEW.contact_id)
AND c.contact_id = :NEW.contact_id
AND cft.function_type_code = :NEW.function_type_code;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
v_function_type_code := :NEW.function_type_code;
v_multiples_permitted := '?';
END;
** if the query returns a v_multiples_permitted of 'Y' or no record is found, then it is
** ok to add the record. Otherwise raise an error because that function_type is already
** being used at the current acct.
IF v_multiples_permitted = 'N'
THEN
RAISE e_multiples_not_permitted;
END IF;
EXCEPTION
WHEN e_multiples_not_permitted
THEN
raise_application_error (-20001,
'Multiples not allowed for function type '
|| v_function_type_code
|| '. sqlerrm - '
|| SQLERRM
WHEN OTHERS
THEN
RAISE;
END;
/:p -
Multiple rows insert and update form example
I just want to share with you an example of a multiple rows insert and update form. You can access it HERE (http://tryapexnow.com/apex/f?p=12090:21)
You will find on the same page the complete description of all elements used to buid it.
I'm waiting for opinions, suggestions, and questions here in this thread.
ThanksHello Valentin,
I got an error message when I clicked on the weblink. Here is the message
Error ERR-7620 Could not determine workspace for application. Could you please take a look at this.
Thanks,
Karol -
ROW-00014: Cannot update row as the data in the database has changed
We're having the problem below. We are trying to upgrade a 10g Oracle database via a linked server in SQL Server 2008.
OLE DB provider "OraOLEDB.Oracle" for linked server "abc" returned message "ROW-00014: Cannot update row as the data in the database has changed".
Mensagem 7343, Nível 16, Estado 4, Linha 1
The OLE DB provider "OraOLEDB.Oracle" for linked server "abc" could not UPDATE table "[OraOLEDB.Oracle]".
Can anyone help?
Thank you.
Edited by: user10641061 on 14/10/2011 18:48The columns that I want insert in oracle database have this data:
JULIO DE SANT’ ANNA KOLISNHG 1968-10-04 00:00:00.000 S F 10 9 RUA, N° 999 / APT° 99999 RJ TH 25410003 N°42.018 78550510 125296625 2178942326 2008-11-15 18:58:58.000
Some of this data may be interfering with this insert?
thank you
Edited by: user10641061 on 15/10/2011 15:47
Edited by: user10641061 on 15/10/2011 15:48 -
How to Know, No. of Rows has been Update, throught Triggers
Hi all,
I am having problem in after update trigger. I want to know How many rows has been updated by a sql statement, for that I have written on (AFTER UPDATE TRIGGER ON EMP). But it is not giving any result. I am executing Update statement from
Sqlplus (UPDATE EMP SET SAL=23 WHERE EMPNO=7369;) We cant use Commit, and dbms_output.put_line in trigger. thats why I have used exception.
CREATE OR REPLACE TRIGGER EMP_UPDATE AFTER UPDATE ON EMP
DECLARE
NO NUMBER;
NOROW EXCEPTION;
PRAGMA EXCEPTION_INIT(NOROW, -20101);
BEGIN
NO:=SQL%ROWCOUNT;
IF NO<>0 THEN
RAISE_APPLICATION_ERROR(-20101,'Some Rows UPDATED');
END IF;
END;Hi Sachindra
What SQL*Plus version you are using?
Some versions that come with forms6i they dont write the number of rows updated, they just write operation 44 succeeded or something like that.
But if you use the SQL*Plus database client (sqlplusw.exe or sqlplus.exe) which those 2 get installed with the db you will be able to see the number of rows update/deleted/inserted
SQL> conn scott/tiger
Connected.
SQL> DESC EMP
Name Null? Type
EMPNO NOT NULL NUMBER(4)
ENAME VARCHAR2(10)
JOB VARCHAR2(9)
MGR NUMBER(4)
HIREDATE DATE
SAL NUMBER(7,2)
COMM NUMBER(7,2)
DEPTNO NUMBER(2)
SQL> UPDATE EMP SET SAL = 23 WHERE EMPNO = 7369;
1 row updated.
SQL>
Hope this helps
Regards
Tony G. -
Merging multiple rows in to a single row (when rows meet merging criteria)
Hi
I have a scenario to merge multiple rows in to a single rows when the data in those rows fall in merge criteria .Below is how my data is
Now the merging logic for the above rows is , we need to combine multiple rows in to a single row when the data in those rows permits us to do in that way. Simply saying , its like sandwich where we combine multiple things to a single piece.The output for
the above rows should be
Here we combined Row 1 ,2, 3 in to a single row as the data in those rows permits to merge in to single row. But the row 4 cannot be combined to any of those rows because the data in those rows doesn't permits us do a merge ( As the value of the column
JobSource for the row 4 is different from the other rows ) .
My original data has 56 columns , but for readability i kept only 9 columns.
can you please throw some idea on how to achieve this scenario. I know we need to use CTE for achieving this, but i am not able succeed in doing an iteration on multiple rows.
Appreciate your response .Thanks for your reply .
Rule for merging is simple . First of all there is no unique row identifier for each row , the fact table is not having an identity column in the database . I called row 1 , row 2 etc in my post above only to make better explanation of my scenario.
The rule for merge is below.
1) we can combine only when the data in a column for one row is null & the data in same column for the other row is not null . It should also satisfy the condition where the data in other columns should conflict each other.
2) Data for all columns for the merging rows should not be conflicting (i.e. we should not merge the rows when the data in a column is not equal to the same column in the other row
,considering not null value)
Steps in merging the above source data :
1) Consider the case of row 1 and row 2 in the source, we can combine these rows as the data is satisfying the rule 1 for columns (Jobsource,Flight, Package,Update,Iscancelled
,Result, Severity) and columns (JobID and RuleName ) fall under rule 2. we merge these two rows in to a single row and keep in that in the table.
2) Then the resulting row is again merged with the second row which is present above by applying the rule 1 and rule 2 . Below would be output of merge operation.
Now there would be only two rows in the output . But these rows cannot be merged as the data doesn't satisfy the merge rules 2 . As Jobsource for the row 1 in the above output is "PresubmissionSource" which is not equal
to "PostSubmission" jobSource which is in row 2. So these two rows are left unmerged .So the above two rows would be the output of merge operation on my source data.
This process has to be repeated for all the rows in the table. As of now my table as 92 Million rows with 56 columns which need to be considered for merging rows. I replicated my scenario in 9 columns and 4 rows to understand better. -
How to Comapare Row by Row in ODI Interface
Hi all
i want to Compare Record by Record from my Source Table.
Can any one Explain Logic How can i do through ODI Interface?If you want row by row processing (rather than set based) then look at using Knowledge Modules that implicitly use a cursor via the agent to load the staging table (e.g LKM SQL to SQL) or a KM that explicitly uses a cursor to load the target table (e.g IKM Incremental updata row by row).
It wont be as fast as set based though!
What do you want to do with each row? Can you load them all into the staging area and then process row by row? -
How to copy data between two tables row by row
Hi All,
I have three tables TableA and TableB and TableC
I wanted to write a stored procedure to copy data row by row from TableA to TableB and then update TableC by replacing any record that has the old id (before copying) to the new id after copying the data.
here is the steps
iterate throw all the rows in tableA ( probably with a foreach)
in each iteration we will do the following:
Get current ID (identity) for each record in TableA ( will call it @oldID)
Insert the row in TableB
Get the new ID for the row from TableB will call it (@NewID)
find rows in tableC that has the (@oldID)
replace all ids in tableC with @oldID to @NewID
Thanks in advance0
TableA and TableB are identical they should have the same columns
TableC columns will be ( ID, TableA_ID , Notes)
Maybe you are looking for
-
Computer got serviced, and now it won't do anything.
My late 2007 MBP (2.2, 4GB (2x2 Kingston), 320 Scorpio Black) stopped shooing anything on the screen about two weeks ago. Brought it to apple and they said the video card needed to be replaced. I left it with them and they replaced it. In the store,
-
I have the problem in Adobe Premiere elements 11 with bouncing text (efects "focus" and "blur"). You can see it on video: And if I used these effects, the program is unstable and falling (in editing the effects or in rendering process). Is it problem
-
I would like to encrypt/decrypt a binary file (not text based) in FLEX 3.4 (AIR). I went through the forum, but I did not found any samples on how to do this. Any idea or help is appreciated. Thanks in advanced.
-
Hi. I'm living in an old office building with a lot of other people. We have a cable modem in the basement which feeds ethernet to a router upstairs, and that router feeds two others. At any given moment the system might have as many as 8-10 users. V
-
Problems setting up payment plan on late bill
Hi we are trying to pay our bill of £306 that is late but cannot afford to pay all in one go. We have offered to pay £150 towards the bill then set up a direct debit to cover the rest on top of our normal monthly payment. We have spoken with billing