Purge data older than an year from multiple tables
Hello all,
I have a requirement to purge data older than 1 year.
These are multiple related table with 300 million rows in each and need to delete about 1 million rows. I need to archive the data to a different database for some tables and then delete and for the other tables I dont need to archive but just delete.
All these tables are being used in transactional replication.
I need to join these tables to delete data as some of them wont have a timestamp column
I was thinking to run the purge job based off 2 sql agent jobs one which will archive and the delete and the other which would only delete where archiving is not required. All these tables use a lot of guid based columns.
What would be the best strategy to purge the data? My concern is the transaction replication. Any help in preparing the script to purge data in batches older than 1 year.
Thanks
Hopefully this example will help you:
DECLARE @transactions TABLE (transactionID INT IDENTITY, transactionDate DATE, clientID INT)
DECLARE @clients TABLE (clientID INT IDENTITY, clientName VARCHAR(30))
INSERT INTO @clients (clientName) VALUES ('James'),('Jean-Luc'),('Jonathon'),('Katheryn'),('Ben')
INSERT INTO @transactions (transactionDate, clientID) VALUES ('2000-01-01',1),('2000-01-01',2),('2000-01-01',3),('2000-01-01',4),('2000-01-01',5),('2015-01-01',4),('2015-01-01',5)
DELETE c FROM @clients c
LEFT OUTER JOIN @transactions t
ON c.clientID = t.clientID
AND t.transactionDate > DATEADD(YEAR,-1,CURRENT_TIMESTAMP)
WHERE t.clientID IS NULL
DELETE t FROM @transactions t
WHERE t.transactionDate < DATEADD(YEAR,-1,CURRENT_TIMESTAMP)
SELECT *
FROM @clients
SELECT *
FROM @transactions
Of course, you're going to want to use similar logic to move the records before you delete them, but you can specify the table to delete by its alias in the delete statement.
Similar Messages
-
How to delete data older than three years from DSO
Hi all,
We needs to keep historical data in the DSO only for three years. One way of doing this is by selective deletion we can delete data older than three years but we want to make it authomated. Is it possible to add a process or ABAP program to delete data older than three years.
If it is p[ossible by ABAP code then can you please give me sample code.
Many Thanks in advance.
HarmanSome time for in case of huge volume of data selective deletion is not works, Try for "prunning" option.
It's work as follows
1) Create DSO which is same replica of your Source DSO.
2) Create two transformation
a) from Source DSO to Copy DSO
b) Another is from Copy DSO to Source DSO
3) Transprort Last 3 years records to Copy of Source DSO using DTP Filter range for time.
4) Once data loading from Source DSO to Copy DSO get completed delete all data from Source DSO.
5) Now load data from Copy DSO to Source DSO.
6) After complete loading delete entire data from Source DSO.
I use prunning process to one of my client and it's work perfectly.
Regards,
Sushant
+919820849482 -
Purging the data older than 1 year
I have a requirement to purge data older than 1 year.
Table has 5 billion rows and delete about 4 billion rows in batches.
there is no primary key or indexes on table.
There is column Datetime and i created nonclustered index on table and planning to purge data based on that column.
Any help in preparing the script to purge data in batches older than 1 year.
Thanks,
Ron.As noted above, it is better to build a new table for what you want to keep using SELECT-INTO:
http://www.sqlusa.com/bestpractices/select-into/
Kalman Toth Database & OLAP Architect
SELECT Video Tutorials 4 Hours
New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012 -
Update data provider queryspecification wiith columns from multiple tables
Hi
I have scenario like I need updated a queryspecificaiton with columns from multiple tables
1. Ex:
<bOQuery name="Query">
<resultObjects identifier="DS0.DO1" name="A$Application_ID"/>
<resultObjects identifier="DS0.DO2" name="A$Column_Name"/>
A$Application_ID is from Table A and A$Column_Name from table B
The query is not adding to dataprovier when I am trying to updated from REST API.
Please help me.
Thanks
KalyanHave a look at the Business Intelligence platform RESTful Web Service Developer Guide, section 3.4.7 (p. 197) - Report structure: getting and updating the structure (specifications) of a report, may be a good place to start(?). Also see KBA 1952419 - How to update the properties of a web intelligence report using RESTful web service SDK .
- Ludek
Senior Support Engineer AGS Product Support, Global Support Center Canada
Follow us on Twitter -
Purge FND_LOBS table (attachmentolders than 2 years) to cleanup table space
Hi,
I have a requirement to purge FND_LOBS table (Attachments which is older than 2 years) to cleanup table space.
Please advise me which is the best way to purge FND_LOBS.
I have already gone through the below Notes, but no luck..
871721.1 - How To Purge FND_LOBS?
555463.1 - How to Purge Generic or Purchasing Attachments from the FND_LOBS Table
298698.1 - Avoiding abnormal growth of FND_LOBS table in Applications 11i
303709.1 - Reclaiming unused space in APPLSYSD tablespace
555463.1 - How to Purge Generic or Purchasing Attachments from the FND_LOBS Table
Thanks,
Genoo
Edited by: Geno on Apr 1, 2013 5:32 AMGeno wrote:
None of the Notes solve my requirement, as i do not see an option to Purge only the data which is older than 2 years.
Thanks,
GenooPurging FND_LOBS table can done by running "Purge Obsolete Generic File Manager Data" concurrent program -- Concurrent Processing - How To Add The Concurrent Program "Purge Obsolete Generic File Manager Data" To The Sysadmin User. [ID 216541.1]
You can find more details about the parameters for this concurrent program in (Questions on Purge Obsolete Generic File Manager Data [ID 1165208.1]).
Thanks,
Hussein -
Excahange 2007 Need to permanently delete all emails older than x years
Cant get to the 2007 forum so don't know if this is the right place.
Trying to permanently delete all mail older than 4 years from our Exchange 2007 server. I have worked with Powershell in 2010 (Exchange)
but I cannot run due to some restrictions with 32/64 bit powershell limitations in exchange 2007.
I have searched google and these forums -- there has to be an easy way to do this or someone that can point me in the right direction.
Thanks in advanceHi,
In Exchange 2007, you can use the following cmdlet to delete emails older than the mentioned date from a mailbox.
Export-Mailbox -Identity xxx -StartDate "xx/xx/xxxx" -EndDate "xx/xx/xxxx" -DeleteContent
If you need to perform this on a set of mailboxes, paste all display names to a TXT file, name is as "test.txt". Run the following cmdlet.
Get-Content test.txt | Export-Mailbox -StartDate "xx/xx/xxxx" -EndDate "xx/xx/xxxx" –DeleteContent –Maxthreads 4
Hope this can be helpful to you.
Best regards,
Amy Wang
TechNet Community Support -
Deleting from multiple tables where few tables have same column name
Hi,
I am new to PL/SQL and need some help. I need to delete data older then X years from some 35 odd tables in my schema and out of those tables 25 tables have same column name on which i can have my "where" clause and rest 10 table have different table names. I am doing something like this :
declare
table_list UTL_FILE.FILE_TYPE;
string_line VARCHAR2(1000);
tables_count number:=0;
table_name VARCHAR2(400);
column_name VARCHAR2(400);
BEGIN
table_list := UTL_FILE.FOPEN('ORALOAD','test7.txt','R');
DBMS_OUTPUT.PUT_LINE(table_list);
LOOP
UTL_FILE.GET_LINE(table_list,string_line);
table_name := substr(string_line,1, instr(string_line,'|')-1);
column_name := substr(string_line, instr(string_line,'|')+1);
DBMS_OUTPUT.PUT_LINE(table_name);
DBMS_OUTPUT.PUT_LINE(column_name);
IF column_name = 'SUBMISSION_TIME' THEN
delete from :table_name where to_date(:column_name)<(sysdate-(365*7));
ELSE
delete from || table_name || where ( || to_date(column_name) || ) <(sysdate-(365*7));
END IF;
END LOOP;
EXCEPTION
WHEN NO_DATA_FOUND THEN
UTL_FILE.FCLOSE(table_list);
DBMS_OUTPUT.PUT_LINE('Number of Tables processed is : ' || tables_count);
UTL_FILE.FCLOSE(table_list);
END;
WHERE the text file "text7.txt" contains list of table name and column names separated by a pipe line. But when I execute the above proc it gives error "invalid table name".
Can something like this be done or is there any other way to execute this task of deletion from 35 tables.
Thanks.Thanks for replies. I don't know what I am doing wrong but still not getting this damn thing work...This is the proc i am running now :
declare
table_list UTL_FILE.FILE_TYPE;
string_line VARCHAR2(1000);
tables_count number:=0;
table_name VARCHAR2(4000);
column_name VARCHAR2(4000);
code_text VARCHAR2(2000);
BEGIN
table_list := UTL_FILE.FOPEN('ORALOAD','test7.txt','R');
LOOP
UTL_FILE.GET_LINE(table_list,string_line);
table_name := substr(string_line,1, instr(string_line,'|')-1);
column_name := substr(string_line, instr(string_line,'|')+1);
IF column_name = 'SUBMISSION_TIME' THEN
DBMS_OUTPUT.PUT_LINE('do nothing');
ELSE
code_text:= 'begin delete from'|| (table_name) ||'where to_date' || (column_name) || '<(sysdate-(365*7))';
Execute Immediate code_text;
END IF;
END LOOP;
EXCEPTION
WHEN NO_DATA_FOUND THEN
UTL_FILE.FCLOSE(table_list);
DBMS_OUTPUT.PUT_LINE('Number of Tables processed is : ' || tables_count);
UTL_FILE.FCLOSE(table_list);
END;
But it gives following error :
" ORA-06550: line 1, column 51:
PL/SQL: ORA-00933: SQL command not properly ended
ORA-06550: line 1, column 7:
PL/SQL: SQL Statement ignored
ORA-06550: line 1, column 68:
PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following:
ORA-06512: at line 22 " -
Calendar search not finding calendar events older than a year.
Calendar search cannot find events older than a year.
neither does spotlight search.
iphone 4s 16GB ios version 7.1.2
ipad 32GB with retina (purchased on 2012) ios version 7.1.2
Does anybody has the same issue?
Calendar events over one year old are not found when searched on iOS. Neither on the iPhone nor the iPad. Although they are found on a mac running mavericks calendar app.
All events are displayed when going directly to the month and viewing all the events of each day, but she search feature, the one accessed through the little magnifier, simply cannot find any event older than a year.
I have multiple events in my calendar and I tested them and the last I can find is within 365 days of today. after that events cannot be found.
steps to reproduce:
1. go into the calendar app on the iPhone and add an event but use a date date 13 months older than the current date. Save the event.
2. verify the even is created by looking at the day of the event
3. on the top right corner of the calendar app select the magnifying glass and try to search the event by typing any word you used on the title of the event just created
4. search result will display No Results
5. exit the calendar and access spotlight search on the home screen by using the "pull down" gesture from an area outside of the dock, including the top row of app icons. Type any word you used on the title of the event just created
6. search result will not display the event
Thanksthis has already been answered.
please ignore my question. -
Update On data from multiple Tables
How can i update data from multiple tables(Using a Join)
using a single update statement.Hii
Suppose i have following tables
create table emp_mas(empno number primary key,name varchar2(30));
create table emp_grad(empno number primary key,grade varchar2(1));
SQL> select * from emp_grad;
EMPNO G
100 A
101 A
102 B
SQL> select * from emp_mas;
EMPNO NAME
100 GREG
101 THOMAS
102 SAM
I would like to update information of employee 'GREG' Using a single update statement as
UPDATE (SELECT E.EMPNO,E.NAME,G.GRADE FROM EMP_MAS E,EMP_GRAD G WHERE E.EMPNO=G.EMPNO) J
SET J.NAME='GREG THOMAS',J.GRADE='B' WHERE EMPNO=100
Then i am getting Error message like this.
ERROR at line 2:
ORA-01776: cannot modify more than one base table through a join view
How can i achieve the result -
Generic datasource by function module to fetch data from multiple tables?
I'm writing a function module to fetch price, for generic datasource.
At first, extract test is OK. But InfoPackage never stop when loading data to PSA in BW.
And I find the example codes:
OPEN CURSOR WITH HOLD S_CURSOR FOR
SELECT (S_S_IF-T_FIELDS) FROM SFLIGHT
WHERE CARRID IN L_R_CARRID AND
CONNID IN L_R_CONNID.
ENDIF. "First data package ?
* Fetch records into interface table.
* named E_T_'Name of extract structure'.
FETCH NEXT CURSOR S_CURSOR
APPENDING CORRESPONDING FIELDS
OF TABLE E_T_DATA
PACKAGE SIZE S_S_IF-MAXSIZE.
IF SY-SUBRC <> 0.
CLOSE CURSOR S_CURSOR.
RAISE NO_MORE_DATA.
ENDIF.
S_COUNTER_DATAPAKID = S_COUNTER_DATAPAKID + 1.
ENDIF.
There using Cursor to fetch data package by package, and raise exception NO_MORE_DATA to stop the loading process.
Now I fetch data from multiple tables, I don't think I can use Cursor.
Then How can I handle this?
Thanks a lot.Thanks
IF IT_999[] IS INITIAL.
SELECT A~KNUMH A~MATNR A~KSCHL VKORG VTWEG A~DATBI A~DATAB KBETR KMEIN KPEIN C~MTART APPENDING CORRESPONDING FIELDS OF
TABLE TP_DATA
FROM A999 AS A
INNER JOIN KONP AS B
ON A~KNUMH = B~KNUMH
INNER JOIN MARA AS C
ON A~MATNR = C~MATNR
* FOR ALL ENTRIES IN IT_999
WHERE
* A~KNUMH = IT_999-KNUMH AND
( ( A~KSCHL = 'ZPRC' AND VKORG = 'Z000' AND VTWEG = 'Z1' ) OR
( A~KSCHL = 'ZPRD' AND VKORG = 'A000' AND VTWEG = 'Y3' ) ) AND
* A~DATBI >= SY-DATUM AND
LOEVM_KO = ''.
SELECT A~KNUMH A~MATNR A~KSCHL VKORG VTWEG A~DATBI A~DATAB KBETR AS KHETR KMEIN KPEIN C~MTART APPENDING CORRESPONDING FIELDS OF
TABLE TP_DATA
FROM A999 AS A
INNER JOIN KONP AS B
ON A~KNUMH = B~KNUMH
INNER JOIN MARA AS C
ON A~MATNR = C~MATNR
* FOR ALL ENTRIES IN IT_999
WHERE
* A~KNUMH = IT_999-KNUMH AND
A~KSCHL = 'ZPR3' AND A~VKORG = 'I000' AND
* DATBI >= SY-DATUM AND
LOEVM_KO = ''.
ENDIF.
IF IT_997[] IS INITIAL.
SELECT A~KNUMH A~MATNR A~KSCHL VTWEG A~DATBI A~DATAB KBETR AS KHETR KMEIN KPEIN C~MTART APPENDING CORRESPONDING FIELDS OF
TABLE TP_DATA
FROM A997 AS A
INNER JOIN KONP AS B
ON A~KNUMH = B~KNUMH
INNER JOIN MARA AS C
ON A~MATNR = C~MATNR
* FOR ALL ENTRIES IN IT_997
WHERE
* A~KNUMH = IT_997-KNUMH AND
A~KSCHL = 'ZPRA' AND VTWEG = 'Y1' AND
* DATBI >= SY-DATUM AND
LOEVM_KO = ''.
ENDIF.
IF IT_996[] IS INITIAL.
SELECT A~KNUMH A~MATNR A~KSCHL A~DATBI A~DATAB KBETR AS KHETR KMEIN KPEIN C~MTART APPENDING CORRESPONDING FIELDS OF
TABLE TP_DATA
FROM A996 AS A
INNER JOIN KONP AS B
ON A~KNUMH = B~KNUMH
INNER JOIN MARA AS C
ON A~MATNR = C~MATNR
* FOR ALL ENTRIES IN IT_996
WHERE
* A~KNUMH = IT_996-KNUMH AND
A~KSCHL = 'ZPRB' AND
* DATBI >= SY-DATUM AND
LOEVM_KO = ''.
ENDIF.
SELECT MATNR "u7269u6599u53F7u7801
MEINH "u4ED3u50A8u5355u4F4Du7684u5907u7528u8BA1u91CFu5355u4F4D
UMREZ "u57FAu672Cu8BA1u91CFu5355u4F4Du8F6Cu6362u5206u5B50
UMREN "u8F6Cu6362u4E3Au57FAu672Cu8BA1u91CFu5355u4F4Du7684u5206u6BCD
FROM MARM
INTO CORRESPONDING FIELDS OF TABLE IT_MARM
FOR ALL ENTRIES IN TP_DATA
WHERE MATNR = TP_DATA-MATNR AND MEINH = TP_DATA-KMEIN.
LOOP AT TP_DATA.
IF TP_DATA-KPEIN NE 0.
TP_DATA-KBETR = TP_DATA-KBETR / TP_DATA-KPEIN.
TP_DATA-KHETR = TP_DATA-KHETR / TP_DATA-KPEIN.
ENDIF.
IF TP_DATA-KSCHL = 'ZPRA'.
* TP_DATA-MEINH = 'ZI'.
* TP_DATA-KSCHL = 'B4'.
IF TP_DATA-KMEIN = 'ZI'.
TP_DATA-KBETR = TP_DATA-KHETR / '1.17'.
ELSE.
READ TABLE IT_MARM INTO WA_MARM1 WITH KEY MATNR = TP_DATA-MATNR MEINH = TP_DATA-KMEIN.
* READ TABLE IT_MARM INTO WA_MARM2 WITH KEY MATNR = TP_DATA-MATNR MEINH = 'CT'.
TP_DATA-KHETR = TP_DATA-KHETR * WA_MARM1-UMREN / WA_MARM1-UMREZ.
* * WA_MARM2-UMREZ / WA_MARM2-UMREN.
TP_DATA-KBETR = TP_DATA-KHETR / '1.17'.
ENDIF.
ELSEIF TP_DATA-KSCHL = 'ZPRB'.
* TP_DATA-KSCHL = 'L0'.
* TP_DATA-MEINH = 'ZI'.
IF TP_DATA-KMEIN = 'ZI'.
TP_DATA-KBETR = TP_DATA-KHETR / '1.17'.
ELSE.
READ TABLE IT_MARM INTO WA_MARM1 WITH KEY MATNR = TP_DATA-MATNR MEINH = TP_DATA-KMEIN.
* READ TABLE IT_MARM INTO WA_MARM2 WITH KEY MATNR = TP_DATA-MATNR MEINH = 'BAG'.
TP_DATA-KHETR = TP_DATA-KHETR * WA_MARM1-UMREN / WA_MARM1-UMREZ.
* * WA_MARM2-UMREZ / WA_MARM2-UMREN.
TP_DATA-KBETR = TP_DATA-KHETR / '1.17'.
ENDIF.
ELSEIF TP_DATA-KSCHL = 'ZPRC' OR TP_DATA-KSCHL = 'ZPRD'.
* TP_DATA-MEINH = 'ZI'.
IF TP_DATA-KMEIN = 'ZI'.
TP_DATA-KHETR = TP_DATA-KBETR * '1.17'.
ELSE.
READ TABLE IT_MARM INTO WA_MARM1 WITH KEY MATNR = TP_DATA-MATNR MEINH = TP_DATA-KMEIN.
* READ TABLE IT_MARM INTO WA_MARM2 WITH KEY MATNR = TP_DATA-MATNR MEINH = 'WZI'.
TP_DATA-KBETR = TP_DATA-KBETR * WA_MARM1-UMREN / WA_MARM1-UMREZ.
* * WA_MARM2-UMREZ / WA_MARM2-UMREN.
TP_DATA-KHETR = TP_DATA-KBETR * '1.17'.
ENDIF.
ELSEIF TP_DATA-KSCHL = 'ZPR3'.
* TP_DATA-KSCHL = 'B2'.
IF TP_DATA-KMEIN = 'ZI'.
TP_DATA-KBETR = TP_DATA-KHETR / '1.17'.
ELSE.
READ TABLE IT_MARM INTO WA_MARM1 WITH KEY MATNR = TP_DATA-MATNR MEINH = TP_DATA-KMEIN.
* READ TABLE IT_MARM INTO WA_MARM2 WITH KEY MATNR = TP_DATA-MATNR MEINH = 'BAG'.
TP_DATA-KHETR = TP_DATA-KHETR * WA_MARM1-UMREN / WA_MARM1-UMREZ.
* * WA_MARM2-UMREZ / WA_MARM2-UMREN.
TP_DATA-KBETR = TP_DATA-KHETR / '1.17'.
ENDIF.
ENDIF.
TP_DATA-MEINH = '01'.
MODIFY TP_DATA.
E_T_DATA-MATNR = TP_DATA-MATNR.
E_T_DATA-KSCHL = TP_DATA-KSCHL.
E_T_DATA-KHETR = TP_DATA-KHETR.
E_T_DATA-KBETR = TP_DATA-KBETR.
E_T_DATA-KMEIN = TP_DATA-KMEIN.
E_T_DATA-DATAB = TP_DATA-DATAB.
E_T_DATA-DATBI = TP_DATA-DATBI.
APPEND E_T_DATA.
CLEAR WA_MARM1.
CLEAR WA_MARM2.
ENDLOOP.
Edited by: Shen Peng on Oct 20, 2010 10:09 AM -
Move data from multiple Tables to a Single Table & Convert the list to ALV.
Hi,
My aim is to get the list of Materials with their descriptions, with MRP Controller, with Unrestriced Qty. & the Reorder Qty. So, I have to fetch the data from different tables. But finally I am not able to copy or move the fetched data from multiple tables into the single final table.
Also tell me how to convert this list into ALV.
Below is the program code.
*& Report Y_REORDER_REPORT
REPORT Y_REORDER_REPORT.
tables : marc,makt, mard.
DATA: Begin of i_final occurs 0,
matnr type marc-matnr,
maktx type makt-maktx,
DISPO type marc-DISPO,
MINBE type marc-MINBE,
LABST type mard-LABST,
end of i_final.
DATA: Begin of i_marc occurs 0,
matnr type marc-matnr,
DISPO type marc-DISPO,
MINBE type marc-MINBE,
end of i_marc.
DATA: Begin of i_makt occurs 0,
matnr type makt-matnr,
maktx type makt-maktx,
end of i_makt.
DATA: Begin of i_mard occurs 0,
matnr type mard-matnr,
LABST type mard-LABST,
LGORT TYPE MARD-LGORT,
end of i_mard.
SELECT matnr
dispo
minbe from marc
into corresponding fields of table i_marc
where dispo EQ 'STR'.
SORT I_MARC by MATNR.
WRITE: /10 'Material',
75 'MRP',
80 'Reorder Qty.'.
LOOP at i_marc.
Write: /10 i_marc-matnr,
75 i_marc-dispo,
80 i_marc-minbe.
ENDLOOP.
write: /.
SELECT matnr
MAKTX from makt
into corresponding fields of table i_makt
for all entries in i_marc
where matnr = i_marc-matnr.
LOOP at i_makt.
Write: /10 i_makt-matnr,
30 i_makt-maktx.
ENDLOOP.
SELECT matnr
LGORT
LABST from mard
into corresponding fields of table i_mard
for all entries in i_marc
where matnr = i_marc-matnr.
LOOP at i_mard.
Write: /10 i_mard-matnr,
30 I_MARD-LGORT,
40 i_mard-labst.
ENDLOOP.
move i_mard-matnr to i_final-matnr.
move i_marc-dispo to i_final-dispo.
move i_marc-minbe to i_final-minbe.
move i_makt-maktx to i_final-maktx.
move i_mard-labst to i_final-labst.
WRITE: /10 'Material',
30 'Material Desc.',
75 'MRP',
80 'Reorder Qty.',
105 'Current Stock'.
LOOP at i_final.
Write: /10 i_final-matnr,
30 i_final-maktx,
75 i_final-dispo,
80 i_final-minbe,
105 i_final-labst.
ENDLOOP.
*LOOP at i_mard.
*Write: /10 i_mard-matnr,
30 i_makt-maktx,
75 i_marc-dispo,
80 i_marc-minbe,
105 i_mard-labst.
*ENDLOOP.
Regards,
VishalChange like this,
SELECT matnr
lgort
labst FROM mard
INTO CORRESPONDING FIELDS OF TABLE i_mard
FOR ALL ENTRIES IN i_marc
WHERE matnr = i_marc-matnr.
LOOP AT i_mard.
WRITE: /10 i_mard-matnr,
30 i_mard-lgort,
40 i_mard-labst.
ENDLOOP.
LOOP AT i_marc.
READ TABLE i_mard WITH KEY matnr = i_marc-matnr.
READ TABLE i_makt WITH KEY matnr = i_marc-matnr.
MOVE i_mard-matnr TO i_final-matnr.
MOVE i_marc-dispo TO i_final-dispo.
MOVE i_marc-minbe TO i_final-minbe.
MOVE i_makt-maktx TO i_final-maktx.
MOVE i_mard-labst TO i_final-labst.
APPEND i_final.
ENDLOOP.
WRITE: /10 'Material',
30 'Material Desc.',
75 'MRP',
80 'Reorder Qty.',
105 'Current Stock'. -
How to extract data from multiple tables (always got errors)
Dear Experts,
I have a simple mapping to extract data from multiple tables as a source (A, B, C) to a target table (X). Below is the picture:
(Sources)....(Target)
A----------------***
B----------------X
C----------------***
Sample Source Data:
Table A:
ColA1
100
200
etc
Table B:
ColB1 ColB2 ColB3
10 Y Ten
20 Y Twenty
30 Y Thirty
etc
Table C:
ColC1 ColC2
11
12
13
etc
Target table (X) should be (just has 1 group INGRP1):
ColA1 ColB1 ColB3 ColC1
100 10 Ten 11
100 10 Ten 12
100 20 Twenty 21
etc
Scenarios:
1. Directly map from A, B, C to X. Unable to map with error message: "API8003: Connection target attribute group is already connected to an incompatible data source. Use a Joiner or Set operator to join the upstream data first before connecting it into this operator."
2. Map each source to Expression Operator and then map from each Expression to target table. I am able to map all attributes successfully but got error when validating it with message: "VLD-1104: Attributes flowing into TEST.EXPR_SRC.INGRP1 have different data sources."
How can I achieve the correct mapping for this purpose?
Use Joiner? I have no key to join the sources
Use Set? The sources have different number of columns
Thanks in advance
PratThanks Nico,
I think it will results data like this:
100 10 Ten 11
200 20 Twenty 12
300 30 Thirty 13
etc
and not the expected:
100 10 Ten 11
100 10 Ten 12
100 20 Twenty 21
etc
But it inspired me to solve this by adding key expression in each source table (B & C) to be joined to table A with this formula:
100+TRUNC(INGRP1.COLB1,-2)
Regards
Prat -
JDBC-XI-FILE scenario. How to extract data from multiple tables
Hi,
At this moment I didn't have the access for XI system. So here I have some silly question. Could you please clarify the same ??
If I got to extract data from single table using JDBC adapter I can put the below query in communication channel
SELECT *FROM orders WHERE new='true'.
But if I got to extract data from multiple tables, logic to be used should be like as shown below. ( from previous thread------prabhu).
SELECT <Table_2>.EID, <Table_2>.FName, <Table_2>.LName, <Table_1>.REC_DAT, <Table_1>.DESCRP
FROM <Table_1> INNER JOIN <Table_2> on
<Table_1>.CARDNO = <Table_2>.CARD
where REC_DAT = <condition>
union
SELECT <Table_2>.EID, <Table_2>.FName, <Table_2>.LName, <Table_1>.REC_DAT, <Table_1>.DESCRP
FROM <Table_1> INNER JOIN <Table_2> on
<Table_1>.CARDNO = <Table_2>.CARD
where REC_DAT = <condition>
But my query is ........how to put the above entire code in one line. (i.e in Qery place of communication channel ) ??
Thanks
KumarHi Palnati,
You either use a select query with join or a stored procedure which will contain the logic to extract the data from multiple tables. But, the limitation in case of stored procedure is u can hv only one selct query in it.
You write ur actual query provided in the parameter 'Query SQL Statement". u can also wrt a stored procedure in it. Also, u can provide a update statement in it which will update a certain flag so tht u don selct the data again.
Check the following link
<a href="http://help.sap.com/saphelp_nw04/helpdata/en/14/80243b4a66ae0ce10000000a11402f/frameset.htm">http://help.sap.com/saphelp_nw04/helpdata/en/14/80243b4a66ae0ce10000000a11402f/frameset.htm</a>
Regards,
Akshay
Message was edited by:
Akshay Salunke -
Query regarding the data type for fetcing records from multiple ODS tables
hey guys;
i have a query regarding the data type for fetcing records from multiple ODS tables.
if i have 2 table with a same column name then in the datatype under parent row node i cant add 2 nodes with the same name.
can any one help with some suggestion.Hi Mudit,
One option would be to go as mentioned by Padamja , prefxing the table name to the column name or another would be to use the AS keyoword in your SQL statement.
AS is used to rename the column name when data is being selected from your DB.
So, the query Select ename as empname from emptable will return the data with column name as empname.
Regards,
Bhavesh -
Loading Data from multiple tables into essbase using ODI
Hi,
We have a scenario where data comes from multiple tables. I would like to know how will ODI load this data for the right combination of the membersHi,
I take it each data table has a field which maps to the other table. You can just drag the datastores on to the source interface and create a join between the tables.
Cheers
John
http://john-goodwin.blogspot.com/
Maybe you are looking for
-
Hi! I look for a way how to create PDF file that contains multiple versions of document. Like there is function "Show signed version" in the Adobe Acrobat, there should be something like "Show version xxx" and "Compare this version to version xxx". I
-
Hey all, I have recently been given the opportunity to provide a wireless network solution to a 3 adjacent condos. As condos at a beach go, they are composed of 99% concrete and glass. My ability to run cable is extremely limited as every cubic centi
-
Q150 DisplayPor​t to HDMI output FAIL
I upgraded my Q150 from Win7HP to Win7Ult and now do not get audio out through the HDMI port. It was working with the 7HP but I've lost the capability. I do get video out. I have checked all the settings and downloaded and installed new realtek a
-
Hello, I have few basic questions on CDS views and AMDPs: 1. How do we identify the potential candidates in existing code where CDS views or AMDPs can/should be used for code-push down? Are there any recommendations? 2. Should CDS views or AMDPs be u
-
Default gender field in IT 0002
Hi Team, We need to default the gender field to 'male' in IT 0002. How & where can we do this? Is there a feature for this? Thanks SKR