How to process each records in the derived table which i created using cte table using sql server
I want to process each row from the CTE table I created, how can I traverse from first row to second row and so on....
how to process each records in the derived table which i created using cte table using sql server
Ideally you would be doing a set based processing rather than traversing row by row as thats more efficient. To answer it specific to your scenario we may need more info. Can you explain with some sample data your exact requirement?
Please Mark This As Answer if it solved your issue
Please Mark This As Helpful if it helps to solve your issue
Visakh
My MSDN Page
My Personal Blog
My Facebook Page
Similar Messages
-
How to collect similar record from the internal table
I need to collect exact matched records from 1 internal table to another internal table by searching 5 fields. I need to have records which are exactly matched for 5 fields. i have written a code wich is mention below it gave me only similar records but not 100% matched record.. would you like to help me. any correction, suggetion,. Will be great help to me.
To get exact match of 5 records, do as follows.
Check whether internal table gives only one record or not after READ statement.If internal table gives more than one entry for READ then the results will be improper.
I think there is no need of READ statement on same internal table within LOOP. I commented the same in code.
sort i_bp_p by title initials name_last idnumber idtype f50code rbcode. "acc_num.
loop at i_bp_p into wa_i_bp_p.
*lv_tabix = sy-tabix.
*read table i_bp_p index lv_tabix into wa_i_bp_p.read table i_but0id into wa_but0id with key idnumber = wa_i_bp_p-idnumber
idtype = wa_i_bp_p-idtype binary search.
if sy-subrc = 0.
read table i_but000 into wa_but000 with key title = wa_i_bp_p-title
initials = wa_i_bp_p-initials
name_last = wa_i_bp_p-name_last binary search.
if sy-subrc = 0.
read table i_but0is into wa_but0is with key f50code = wa_i_bp_p-f50code
rbcode = wa_i_bp_p-rbcode binary search.
if sy-subrc = 0.
move-corresponding wa_i_bp_p to i_bp_p100.
append i_bp_p100.
endif.
endif.
endif.
endloop.
sort i_bp_p100 by partner.
loop at i_bp_p100.
write : /10 i_bp_p100-partner,
20 i_bp_p100-title,
30 i_bp_p100-initials,
40 i_bp_p100-name_last,
53 i_bp_p100-idnumber,
70 i_bp_p100-idtype,
85 i_bp_p100-rbcode,
95 i_bp_p100-f50code.
endloop.
sort i_bp_p by title initials name_last idnumber idtype f50code rbcode. "acc_num.
loop at i_bp_p into wa_i_bp_p.
lv_tabix = sy-tabix.
read table i_bp_p index lv_tabix into wa_i_bp_p.
if sy-subrc = 0.
read table i_but0id into wa_but0id with key idnumber = wa_i_bp_p-idnumber
idtype = wa_i_bp_p-idtype binary search.
if sy-subrc = 0.
read table i_but000 into wa_but000 with key title = wa_i_bp_p-title
initials = wa_i_bp_p-initials
name_last = wa_i_bp_p-name_last binary search.
if sy-subrc = 0.
read table i_but0is into wa_but0is with key f50code = wa_i_bp_p-f50code
rbcode = wa_i_bp_p-rbcode binary search.
if sy-subrc = 0.
move-corresponding wa_i_bp_p to i_bp_p100.
append i_bp_p100.
endif.
endif.
endif.
endif.
endloop. -
How to maintain previous and record count in audit table in SQL Server 2008 r2?
Hi Experts ,
Situation :
in our database we are having few of stored procedures which will drop and recreates the tables and it is scheduled on weekly basis. when this job will run all the stored procedures will drop all the tables and recreate. Now we need to create one table which
will maintain history of the records.
my table structure is listed below
TableName CurrentReocrdCount CurrentExecutionDate PreviousReordCount PreviousExurtiondate
TEST 1000 2014-03-30 NULL NULL
Test 1500 2014-04-10 1000 2014-03-30
Test 2000 2014-04-11 1500 2014-04-10
How do i achive this .
franklinsentilYou need to create audit tables for these. The table will be populated by COUNT value inside stored procedure. Each time it clears the main table and fills new data and also logs count details to audit tables. You can use COUNT(*) to get count value
and GETDATE function to get current execution value.
So proc will look like
CREATE PROC procname
@param....
AS
--step to drop existing table
IF OBJECT_ID('tablename') IS NOT NULL
DROP TABLE <table name>
--step to fill new table
SELECT ...
INTO TableName
FROM
--Audit table fill step
INSERT AuditTable (TableName,CurrentRecordCount,CurrentExecdate,PrevRecordCount,PrevExecDate)
SELECT TOP 1 'TableName',(SELECT COUNT(*) FROM tableName),GETDATE(),CurrentRecordCount,CurrentExecDate
FROM AuditTable
ORDER BY CurrentExecDate DESC
UNION ALL
SELECT 'TableName',(SELECT COUNT(*) FROM tableName),NULL,NULL
WHERE NOT EXISTS (SELECT 1 FROM AuditTable)
GO
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
I am not able to close the popup screen which i created using module pool
Hi,
I had written the following code in my PBO of the screen
PROCESS BEFORE OUTPUT.
MODULE status_0300.
MODULE call_list_0300.
PROCESS AFTER INPUT.
MODULE exit AT EXIT-COMMAND.
MODULE USER_COMMAND_0300.
*& Module call_list_300 OUTPUT
MODULE call_list_0300 OUTPUT.
LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN 0.
SET PF-STATUS '300'.
SUPPRESS DIALOG.
PERFORM get_document_text.
ENDMODULE.
*& FORM get_document_text.
FORM get_document_text.
ENDFORM
when i execute... since the screen is directed to list processing, when i click the close button the popup window is not getting closed
what should i do to close the list processing screenIf your screen is popup screen than your PF-Status must be type of "Dialog Box".
Than you will get the buttons at the bottom part of your pop-up which will allow you to interact with your PAI.
Regards,
Naimesh Patel -
How to insert new record in the database table using the Jdeveloper
Hi Masters
I am new Bee in j2EE developing side and i ahve oracle jdeveloper 9i version is 9.0.4
And now I wann to know that how can i create the web application that will enter the Data in the HTML FORM and save that data into the Table emp plz tell me step by step
thx in advancethe steps to follow -
download JDeveloper 10.1.2 from OTN (9.0.4 is very old and has some features that won't be in the next releases).
Then follow the ADF Workshop from the JDeveloper home page on OTN.
(If you have to use 9.0.4 then look for the archives of JDeveloper on OTN)
for example:
http://www.oracle.com/technology/products/jdev/viewlets/viewlet-archive0903.html -
How to insert a record to the z-table.
Hi Experts,
I have created one z-tabe with fields
refnum, and
status.
if the refnum is >200 ; Status field should get the value as "TRUE" else "FALSE".
could any one help me on this.
regards,
Sunilhi,
try this.
data : itab type standard table of (name of ur ztable) with header line.
select * from (ztable) into table itab.
loop at itab.
if itab-refnum > 200.
itab-status = 'true'.
else.
itab-status = 'false'.
endif.
modify table itab[] from itab index sy-tabix.
endloop.
update (ztable) from table itab.
hope this gives some idea. -
I want to get all the documents based on content type using SQL Server Query. I know that, querying the content database without using API is not advisable, but still i want to perform this action through SQL Server Query. Can someone assist ?
You're right, it's not advisable, may result in corruption of your databases and might impact performance and stability. But assuming you're happy to do that then it is possible.
Before you go down that route, have you considered using something more safe like PowerShell? I've seen a script exactly like the one you describe and it would take far less time to do it through PS than it would through SQL. -
How to commit each record in Oracle Form Personalization
Hi,
how to commit each record with out using save button in form...my requirement is when cursor goes to next record it vil automatically stored in database please give me your valuable suggestion...
Actual Requirement:
here we need to give the locators(it is number) whenever the cursor goes to next record it vil automatically incremented by 1(i wrote query for incremetation) and previous one vil be stored in database.
Here i am using WHEN NEW ITEM INSTANCE IS USED Trigger..
Thank You,
Regards,
PuttaHi,
The commit should be done by the form, or whatever raises the business event.
The API fires the event in the same transaction (unless the subscription is deferred), and then the commit is issued. This commits the transaction, and all actions of the event subscription.
If the subscription is deferred, then the concurrent request which processes the subscription will issue the commit on completion.
HTH,
Matt
WorkflowFAQ.com - the ONLY independent resource for Oracle Workflow development
Alpha review chapters from my book "Developing With Oracle Workflow" are available via my website http://www.workflowfaq.com
Have you read the blog at http://thoughts.workflowfaq.com ?
WorkflowFAQ support forum: http://forum.workflowfaq.com -
How to get each thread in the threadpool
Hi,everyone.I'm now learning java.util.concurrent package and I have two questions about the threadpool.
1) How to get each thread in the threadpool;
2) How to get each thread's data in the threadpool and dispaly them onto GUI;
e.g :
There are 5 threads in the threadpool(ThreadPoolExecutor) and I have 100 tasks(Runnable or Callable),every task scans a directory(every task scans a different directory),how can I display the "real-time" count of the files in the directory which the current 5 threads in the threadpool scan onto the ListView Items in the GUI?Willings wrote:
Hi,everyone.I'm now learning java.util.concurrent package and I have two questions about the threadpool.
1) How to get each thread in the threadpool;You don't
2) How to get each thread's data in the threadpool and dispaly them onto GUI;
e.g : You don't
There are 5 threads in the threadpool(ThreadPoolExecutor) and I have 100 tasks(Runnable or Callable),every task scans a directory(every task scans a different directory),how can I display the "real-time" count of the files in the directory which the current 5 threads in the threadpool scan onto the ListView Items in the GUI?You should notify your "monitor" when you add something to the pool, and the Runnable/Callable should notify the same "monitor" when it starts to execute, and during its processing. Finally you notify the monitor when the execution has completed.
Kaj -
Create single message in receiving side for each record in the sender file
Dear Experts,
My Interface is from FILE to MQ (JMS)..
I have a specific requirement in my project, I have multiple files in sender directory ( /tmp)
Ex: FILE_20090202.TXT
FILE_20090203.TXT
FILE_20090204.TXT
FILE_20090205.TXT
And each file has couple of records just shown below:
ABC 123 WER SER
BCD 345 WEDR SER
CDE 567 GHTE DDGG u2026. Etc..
I have to process all the files at a time ( may be I can use file masking by FILE*.txt) , one message has to be created in MQ for each record of the file..
Ex:
Message 1: ABC 123 WER SER
Message 2: BCD 345 WEDR SER
Message 3: CDE 567 GHTE DDGG
Valuable inputs are appiciated !!
Cheers,
KumarAs already suggested, multi-mapping can be used
You need to set target root node occurrence to unbounded and map root node accordingly
you will have to use enhanced interface determinaion
For detail refer:
/people/jin.shin/blog/2006/02/07/multi-mapping-without-bpm--yes-it146s-possible -
How to delete a record in the target?
Hi all,
In my source i'm having three tables which are joined.My source and target is oracle.
I'm using IKM incremental update oracle.For SCD-1.If i delete a record in any of my source tables i cannot able to delete that particular
record in the target table.I tried by doing CDC(simple) to all my source tables.But still i cannot able to delete a record in the target table.
How to resolve this issue? Please help me.
Thanks in advanceOpen your interface, go to the "flow" tab and then, try to set the option "delete_all" to "Yes". Doing it, all records will be deleted in the target table and only the records that still exists at source will be loaded the next time you run the interface.
I hope this will help with your issue.
Regards,
Daniel Hein -
To create 5 different files in target for each record in the sender file
Hi SapAll,
i have got a a requirement where pi need to create 5 different files with data of each record from the sender side.
Its an file to file scenario
suppose there are 5 rows in a file , then in target side i need to create 5 diff with each one record in it.
Can we do it without using 3 comm channels
Thanks®ards,
SaiHey,
As a more generic solution, can you try using MultiMapping. It is supposed to generate multiple instances of messages on receiver side.
/people/jin.shin/blog/2006/02/07/multi-mapping-without-bpm--yes-it146s-possible
You just need to put a simple logic in Message Mapping to generate new Node for every occurence of source field.
Thanks
Aamir -
How to process NAST record.....
Hi all,
can anyone tell me how to process Nast record with dispatch time 3 : send periodically with own transaction and with dispatch time 2.
thanks in advance.
vinod.I think you can process using program RSNAST00
Regards
MD -
How to delete Duplicate records from the informatica target using mapping?
Hi, I have a scenario like below: In my mapping I have a source, which may containg unique records or duplicate records. Source and target are different tables. I have a target in my mapping which contains duplicate records. Using Mapping I have to delete the duplicate records in the target table. Target table does not contain any surrogate key. We can use target table as a look up table, but target table cannot be used as source in the mapping. We cannot use post SQL.
Hi All, I have multiple flat files which i need to load in a single table.I did that using indirect option at session level.But need to dig out on how to populate substring of header in name column in target table. i have two columns Id and Name. in all input file I have only one column 'id' with header like H|ABCD|Date. I need to populate target like below example. File 1 File2 H|ABCD|Date. H|EFGH|Date.1 42 5 3 6 Target tale: Id Name1 ABCD2 ABCD3 ABCD4 EFGH5 EFGH6 EFGH can anyone help on what should be the logic to get this data in a table in informatica.
-
How to find the unmatched records between the two tables?
We have to tables in SQL Server database.
But unable to find the unmatched record betwwen these two tables.
There 12 records are unmatched. But unable to get those records.
I am using the below sql:
select c1,c2,c3,c4,c5,c6 from Table1
except select c1,c2,c3,c4,c5,c6 from Table2
Please help. Thanks in advance.Hi knra,
Please try the following codes:
select c1,c2,c3,c4,c5,c6 from Table1 t1
where not exists
(select * from Table2 t2
where t1.c1= t2.c1
and t1.c2= t2.c2
and t1.c3= t2.c3
and t1.c4= t2.c4
and t1.c5= t2.c5
and t1.c6= t2.c6)
Best Regards,
Allen Li
Allen Li
TechNet Community Support
This is what I would've said, but it would make life much easier for you if you have a reference or ID for each entry, this is why we use keys.
Maybe you are looking for
-
Step-by-Step Help Needed for Deploying Some Adobe Software
We are a K-12 educational institution. I am currently working at setting up a computer lab with about 16 MacMini computers. I'm VERY new to the realm of servers, deployment, using terminal, etc. I've done lots of research to make it to where I am, b
-
MacBook Air and problems with Time Capsule in 5GHz Radio Mode
We have our Time Capsule configured to 802.11n only (5 GHz). We've done this to work more efficiently in a particularly noisy wireless area. The problem is that the MacBook Air can't maintain a connection to it and when it loses the connection, the w
-
Error message: No pymt possible because items with a debit
Folks, My vendor line items are Rs 1000- credit memo dated 05/25/2006 pay terms net 30 Rs 50- credit memo dated 06/10/2006 pay terms net 30 Rs 300- credit memo dated 08/10/2006 pay terms net 30 Rs 5000 invocie dated 09/01/2006 pay terms net 3
-
I have a working application that was created using DW 2004MX. I just upgraded to CS3 and am finding that code blocks created before are changed by CS3 (if I update some characteristic) and no longer function. A simple example is a recordset that use
-
How come when i copy txt left aligned indesign keeps on pasting the txt right aligned?
I had to use a indesign english-arabic for a while (turned back to english international afterwards). Ever since i did that when i copy txt left aligned indesign keeps on pasting the txt right aligned. it is mind boggling & very annoying. i've put al