OBIEE Write Back - Updating Multiple tables.

Hi,
I am currenty using OBIEE writeback. Basically, I would like to make changes to 2 tables with a click of the writeback button. I create a function which updates both tables, and called the function in the xml page.
My page looks like this (I am only interested in updates as there will always be values in the relevant fileds):
<?xml version="1.0" encoding="utf-8" ?>
<WebMessageTables xmlns:sawm="com.siebel.analytics.web/message/v1">
<WebMessageTable lang="en-us" system="WriteBack" table="Messages">
<WebMessage name="DayDimWriteBack">
<XML>
<writeBack connectionPool="PRMI Admin Connection Pool">
<insert> </insert>
<update>SELECT f_dq_writeback('@{c8}',TO_DATE('@{c4}','YYYY-MM-DD'),'@{c2}','@{c9}') FROM DUAL</update>
     </writeBack>
</XML>
</WebMessage>
</WebMessageTable>
</WebMessageTables>
My function is:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
create or replace function f_dq_writeback (i_reportable_flag varchar2,
i_date date,
i_username varchar2,
i_comments varchar2)
return varchar2
is
pragma autonomous_transaction;
lv_return varchar2 (1);
begin
update wh_day_dim
set cort_reportable_flag = i_reportable_flag
where day_date = i_date;
commit;
insert into dq_audit (username,creation_date,comments, as_at_date)
values (i_username,sysdate,'CORT_REPORTABLE_FLAG set to '|| i_reportable_flag|| '.'|| i_comments,i_date);
commit;
return lv_return;
exception
when others
then
lv_return := 'N';
raise_application_error (-20011,'Error occured during DQ Writeback: ' || sqlerrm );
end f_dq_writeback;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
This just inserts into one table and updates another based on the parameters in the report.
However, it seems to act inconsistently when run, with results ranging from working fully i.e. amending both tables to amending one to not making any changes at all. The session log clearly shows that it is calling the function, but the results suggest otherwise. :
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-------------------- SQL Request:
EXECUTE PHYSICAL CONNECTION POOL "PRMI Admin Connection Pool" SELECT mi_dwh_cort_utils_pkg.f_dq_writeback('H',TO_DATE('2010-10-08','YYYY-MM-DD'),'FM_AKINMOO','.Telephone') FROM DUAL
+++FM_AKINMOO:390f0000:390f0007:----2010/11/25 13:48:09
-------------------- Sending query to database named PRMI Admin (id: ExecutePhysical Gateway):
SELECT mi_dwh_cort_utils_pkg.f_dq_writeback('H',TO_DATE('2010-10-08','YYYY-MM-DD'),'FM_AKINMOO','.Telephone') FROM DUAL
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Am I doing something wrong or Is there any other way I can amend 2 tables using writeback.
Thanks
Olu

Hi,
Got this error:
The system was unable to generate appropriate SQL. Please contact your system administrator.
Error Details
Template: 'BEGIN mi_dwh_cort_utils_pkg.p_dq_writeback('@{c0}',TO_DATE('@{c1}','YYYY-MM-DD'),'@{c5}','@{c2}'); END;'
Record: '<record action="update"><value columnID="c4">2010-10-08</value><value columnID="c2">FM_AKINMOO</value><value columnID="c8">P</value><value columnID="c9">.teteteeeeree</value></record>'
My xml file is:
<?xml version="1.0" encoding="utf-8" ?>
<WebMessageTables xmlns:sawm="com.siebel.analytics.web/message/v1">
<WebMessageTable lang="en-us" system="WriteBack" table="Messages">
<WebMessage name="DayDimWriteBack">
<XML>
<writeBack connectionPool="PRMI Admin Connection Pool">
<insert> </insert>
<update>BEGIN mi_dwh_cort_utils_pkg.p_dq_writeback('@{c0}',TO_DATE('@{c1}','YYYY-MM-DD'),'@{c5}','@{c2}'); END;</update>
     </writeBack>
</XML>
</WebMessage>
</WebMessageTable>
</WebMessageTables>

Similar Messages

  • OBIEE write back error MSG: OPR4ONWY:U9IM8TAC:OI2DL65P

    Hello there,
    I've been trying to use OBIEE write back function. I've created XML template to insert and update value in OBIEE dashboard and then to the DB. I've look into several research paper, yet I still have the problem. Your help is greatly appreciated. I thank you so much in advance for your help. Arnold
    Pls see the following detailed info concerning this error:
    Error MSG detail:
    =============
    An error occurred while writing to the server. Please check to make sure you have entered appropriate values. If the problem persists, contact your system administrator.
    Odbc driver returned an error (SQLExecDirectW).
    Error code:
    =========
    Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 27024] The EXECUTE PHYSICAL statement must specify a physical SQL statement to execute. (HY000)
    SQL Issued: EXECUTE PHYSICAL CONNECTION POOL SH
    Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 27024] The EXECUTE PHYSICAL statement must specify a physical SQL statement to execute. (HY000)
    SQL Issued: EXECUTE PHYSICAL CONNECTION POOL SH
    XML template:
    ==========
    <?xml version="1.0" encoding="utf-8" ?>
    <WebMessageTables xmlns:sawm="com.siebel.analytics.web/message/v1">
    <WebMessageTable lang="en-us" system="WriteBack" table="Messages">
    <WebMessage name="SHNEW">
    <XML>
    <writeBack connectionPool="SH">
    <insert>INSERT into sales (sales_quota) values(@{c0})</insert>
    <update> </update>
    </writeBack>
    </XML>
    </WebMessage>
    </WebMessageTable>
    </WebMessageTables>

    You don't have any update statement here :
    <update> </update>
    Research when insert part is called and when update is called.

  • Updating Multiple Tables

    Hi All, Is there any way to update multiple tables in a single query. I know we can write triggers. Apart from triggers, is there any other way available in SQL Server. I am using 2008R2.

    As alternative you can write something like that 
    BEGIN TRANSACTION
    BEGIN TRY
    Update
    Update 
    Update
    COMMIT
    END TRY
    BEGIN CATCH
    IF @@TRANCOUNT> 0 ROLLBACK
    END CATCH;
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Updating multiple tables using JDBC Adapter

    Hi,
    I am trying to insert/update multiple tables using one message via JDBC adapter. The following is the message being posted. However, only the first statement was executed. Anything wrong?
    Thanks in advance!
    Hart
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:DeliveryDBUpdate xmlns:ns0="http://test.com/r3_integration"><DeliveryData><DelHeader action="UPDATE_INSERT"><table>DelHeader</table><access><DelNo>0080000230</DelNo><DelType>LF</DelType><XOverwrite>X</XOverwrite><ShipTo>0000000026</ShipTo><SoldTo>0000000026</SoldTo><Priority>00</Priority><DocDate>02/17/2007</DocDate><GText>CIF Test</GText><DelDate>02/20/2007</DelDate><PickDate>02/20/2007</PickDate><ShipPoint>NO02</ShipPoint><PackCount>00000</PackCount></access><key><DelNo>0080000230</DelNo></key></DelHeader>
    <DelItem action="INSERT"><table>DelItem</table><access><DelNo>0080000230</DelNo><ItemNo>000010</ItemNo><GText>10# GRAN-GREAT VALUE</GText><Material>G04410G611</Material><Plant>6005</Plant><SLoc>6005</SLoc><RefDoc>mmenon32</RefDoc><RefItem>00000000</RefItem><DelQty>5.000</DelQty><UOM>BL</UOM></access><access><DelNo>0080000230</DelNo><ItemNo>000020</ItemNo><GText>25# GRAN- GREAT VALUE</GText><Material>G04025G611</Material><Plant>6005</Plant><SLoc>6005</SLoc><RefDoc>mmenon32</RefDoc><RefItem>00000000</RefItem><DelQty>5.000</DelQty><UOM>BG</UOM></access></DelItem></DeliveryData></ns0:DeliveryDBUpdate>

    Hi,
    You need 2 STATEMENT level tags,
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:DeliveryDBUpdate xmlns:ns0="http://test.com/r3_integration">
    <b><DeliveryData1></b>
    <DelHeader action="UPDATE_INSERT">
    <table>DelHeader</table>
    <access>
    <DelNo>0080000230</DelNo>
    <DelType>LF</DelType>
    <XOverwrite>X</XOverwrite>
    <ShipTo>0000000026</ShipTo>
    <SoldTo>0000000026</SoldTo>
    <Priority>00</Priority>
    <DocDate>02/17/2007</DocDate>
    <GText>CIF est</GText>
    <DelDate>02/20/2007</DelDate>
    <PickDate>02/20/2007</PickDate>
    <ShipPoint>NO02</ShipPoint>
    <PackCount>00000</PackCount>
    </access>
    <key>
    <DelNo>0080000230</DelNo>
    </key>
    </DelHeader>
    <b><DeliveryData1></b>
    <b><DeliveryData2></b>
    <DelItem action="INSERT">
    <table>DelItem</table>
    <access>
    <DelNo>0080000230</DelNo>
    <ItemNo>000010</ItemNo>
    <GText>10# GRAN-GREAT VALUE</GText>
    <Material>G04410G611</Material>
    <Plant>6005</Plant>
    <SLoc>6005</SLoc>
    <RefDoc>mmenon32</RefDoc>
    <RefItem>00000000</RefItem>
    <DelQty>5.000</DelQty>
    <UOM>BL</UOM>
    </access>
    <access>
    <DelNo>0080000230</DelNo>
    <ItemNo>000020</ItemNo>
    <GText>25# GRAN- GREAT VALUE</GText>
    <Material>G04025G611</Material>
    <Plant>6005</Plant>
    <SLoc>6005</SLoc>
    <RefDoc>mmenon32</RefDoc>
    <RefItem>00000000</RefItem>
    <DelQty>5.000</DelQty>
    <UOM>BG</UOM>
    </access>
    </DelItem>
    <b></DeliveryData2></b>
    </ns0:DeliveryDBUpdate>
    Try with such a strcuture and let us know if it works.
    Regards
    Bhavesh

  • Resource configuration for updating multiple tables

    Hi all,
    My aim is to update multiple tables in Sun Identity Manager
    I would like to know what is the resource to be configured for this
    Could any one help me in solving this issue
    Thanks in advance,
    Shalini

    I have used the Scripted JBDC resource as follows;
    go to Resources > Configure Types and select Scripted JDBC > Save
    at Resources, select resource Type Actions > New Resource
    select Scripted JDBC from the drop down, this should start the wizard
    the wizard will guide you with lots of questions.
    The one problem we had is in the Action Scripts (second wizard page). we found the example scripts
    at the webserver root /idm/sample/ScriptedJdbc/SimpleTable/beanshell
    the above scripts had to be modified to the SQL required for the application, but it worked well with the example databases and codes that it is easily understood.
    there are several examples of different table types here... there are lots of options, see the README iles for each type
    hope this helps;
    TG

  • OBIEE Write Back ERROR

    Hi All,
    Pl Help me in Resolving the Error
    "Write Back Error
    The system is unable to read the Write Back Template 'HIRING_STATUS'. Please contact your system administrator. "
    FolderPath:\\
    C:\OracleBI\web\msgdb\customMessages\Hiring_status.xml
    Here Table Name is BIDW_Final
    Column Name is Hiring_status where i am trying to write.
    <?xml version="1.0" encoding="utf-8"?>
    <WebMessageTables xmlns:sawnm="com.siebel.analytics.web/message/v1">
    <WebMessageTable lang="en-us" system="WriteBack" table="Messages">
    <WebMessage name="HIRING_STATUS">
    <XML>
    <WriteBack connectionPool="RRF_TEST">
    <Insert> insert into BIDW_FINAL (HIRING_STATUS) values ('@{c1}')
    </Insert>
    <Update> </Update>
    <postUpdate>COMMIT</postUpdate>
    </WriteBack>
    </XML>
    </WebMessage>
    </WebMessageTable>
    </WebMessageTables>
    I gave access,and done all the write back settings given (Follwing eg: OBIEE writeback
    Kindly help me in resolving the issue.
    Thanks in Advance,
    RK

    Hi,
    See the below link, it may help you,
    http://gerardnico.com/wiki/dat/obiee/write_back#support
    The write back name must be the same in the node WebMessage of the xml message
    <WebMessage name="*HIRING_STATUS*">
    Thanks,
    Balaa....
    Edited by: Balaa on Apr 30, 2010 5:09 PM
    Edited by: Balaa on Apr 30, 2010 5:11 PM

  • OBIEE Write Back - Insert New Row

    Hello,
    I am new to these forums and looking for some help with OBIEE's Write Back feature.
    I have Write Back working fine with respect to updating existing rows in a table (ie: the UPDATE tag), but was wondering how to force Write back to invoke the INSERT feature. I would like to be able to create new rows in a table to allow my end user to dynamically add and remove information. I have heard of this being possible (perhaps through some sort of temp. table) in other forum posts, but have yet to see how this is implemented. Also, is it at all possible to use Write Back to delete rows in a table? Any help here would be greatly appreciated. Thanks!
    -Mike
    Here is an exerpt from my working XML file:
    <WebMessage name="NEWSNOTESADMIN">
    <XML>
    <writeBack connectionPool="Oracle Data Warehouse Connection Pool">
    <insert>INSERT INTO WC_NEWS_NOTES (CONTENTS, CONTENT_DATE, IMPORTANCE_LVL) VALUES(@{c0},@c{4},@{c2})</insert>
    <update>UPDATE WC_NEWS_NOTES SET CONTENTS='@{c0}', CONTENT_DATE='@{c4}', IMPORTANCE_LVL=@{c2} WHERE CONTENT_ID='@{c1}' </update>
    </writeBack>
    </XML>
    </WebMessage>

    Well first and foremost, Oracle explicitly states that writeback isn't meant to be used to transform OBIEE into a data entry system. Check the other posts on this subject...
    On the "force insert": put the same statement you have for INSERT into the UPDATE tag. Related to the initial point I mentioned: you will have to worry about uniqueness yourself. OBIEE isn't an OLTP platform!
    Re. delete: I liked Stijns recent post, so I'm going to use that as well:
    http://www.justfuckinggoogleit.com/search.pl?query=obiee+delete+through+writeback
    Third hit. Venkats blog.

  • OBIEE write back - button greyed out.

    Hi
    I have below xml template for write back. I have given same name WriteSpendOpt in table properties and xml file in available under both OracleBI and OracleBIData customMessages folder. But still i don't update button enabled in my screen. Do i miss any steps?
    <?xml version="1.0" encoding="utf-8" ?>
    <WebMessageTables xmlns:sawm="com.siebel.analytics.web/message/v1">
    <WebMessageTable lang="en-us" system="WriteBack" table="Messages">
    <WebMessage name="WriteSpendOpt">
    <XML>
    <writeBack connectionPool="Connection Pool">
    <update>UPDATE OPT_D SET In_Out='@{c24}' WHERE ROW_ID=@{c18}</update>
         </writeBack>
    </XML>
    </WebMessage>
    </WebMessageTable>
    </WebMessageTables>
    Raghav

    Check here:
    http://gerardnico.com/wiki/dat/obiee/presentation_service/write_back#the_update_button_is_gray
    I give some possible reasons for.
    Cheers
    Nico

  • OBIEE Write Back

    Hi,
    I am trying to configure write back in one of my reports. I have already created a Write back template which looks as follows:
    <?xml version="1.0" encoding="utf-8" ?>
    <WebMessageTables xmlns:sawm="com.siebel.analytics.web/message/v1">
         <WebMessageTable lang="en-us" system="WriteBack" table="Messages">
         <WebMessage name="WriteBack">
         <XML>
         <writeBack connectionPool="Connection Pool_DM">
         <insert>INSERT INTO Debt_Fact VALUES('@{c9}')</insert>
         <update>UPDATE Debt_Fact SET Remarks =('@{c9}')</update>
              <postupdate>COMMIT</postupdate>
         </writeBack>
         </XML>
         </WebMessage>
         </WebMessageTable>
    </WebMessageTables>
    When i try to enter values in the write back field it give me the following error:
    An error occurred while writing to the server. Please check to make sure you have entered appropriate values. If the problem persists, contact your system administrator.
    Odbc driver returned an error (SQLExecDirectW).
    Error Details
    Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 43093] An error occurred while processing the EXECUTE PHYSICAL statement. [nQSError: 16001] ODBC error state: 37000 code: 8180 message: [Microsoft][SQL Native Client][SQL Server]Statement(s) could not be prepared.. [nQSError: 16001] ODBC error state: 21S01 code: 213 message: [Microsoft][SQL Native Client][SQL Server]Insert Error: Column name or number of supplied values does not match table definition.. [nQSError: 16002] Cannot obtain number of columns for the query result. (HY000)
    SQL Issued: EXECUTE PHYSICAL CONNECTION POOL "Connection Pool_DM" INSERT INTO Debt_Fact VALUES('d')
    Any Help is appreciated.... Thanks
    Edited by: Siddharth Chitre on May 8, 2010 7:57 PM

    Hi Siddharth,
    I came across the same while implementing the write back.
    Make sure following points are checked.
    1.Table whoch you are updating should disable cache
    2.In Answers,user must have acess writeback previleges.For this access,you need to go manage previleges and give access.
    3.Template name in Answers should match with the values in XML...i.e<WebMessage name="WriteBack">
    For the error,the solution is
    To ignore/fix this error, with ifnull(tablename.Remarks,'n/a') in the Fx section. Try it
    Regards
    Uday Annagiri

  • RFC - XI - JDBC Scenario Updating Multiple Tables

    I'm an XI rookie who is looking for some assistance with my first interface.   I am using an RFC adapter on the outbound side and a JDBC adapter on the inbound side.  My function passes back four internal tables that I would like to map to 4 different oracle tables.  Can this be accomplished in one scenario ?  I think I can achieve this via mapping but I need to be pointed in the right direction.
    Thank you in advance for your help.
    Kevin

    Hi Kevin,
    You can update You can modify one or more database tables by means of a message.
    Please refer this link for more info..
    http://help.sap.com/saphelp_nw04/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm
    Regards
    Anand...

  • Insert/update multiple tables from one form.

    I'm working on an app. that requires the user to fill out a form. The contents from the form is then used to either insert new records or update existing records in multiple tables. Is that possible? Can someone give a details example?

    You should create a form like you would create it having one table. Use row_id as primary key. The rest of the process are done by the triggers - those will take care of updating the right table depending which column was hit.
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://apex.oracle.com/pls/otn/f?p=31517:1
    http://www.amazon.de/Oracle-APEX-XE-Praxis/dp/3826655494
    -------------------------------------------------------------------

  • How to update multiple tables using results from query

    I'm a bit rusty on this stuff and am hoping for some help.
    Table 1 is:
    location_id, location_name
    Table 2 is
    location_id, employee_id and misc. other columns
    Then there are multiple tables with associated data, keys being location_id and employee_id.
    There are no established relationships.
    Trying to come up with a process to change location_id for all employees assigned to a particular location.
    It seems to me that the basics are
    select employee_id from Table2 where location_id='xxxxxx'
    Then take each employee_id returned and change their location_id in each of the other tables
    I'm not clear on how to load the returned employee id's as variables and then loop through them.
    Thanks

    Thanks for the welcome. I'll read up on the rules now.
    Below is the DDL for a couple of the tables.
    Version = 11g
    I would query the users table for all users with a certain site_id and then use them to update the site_id in the users table (and other tables)
    -- DDL for Table USERS
    CREATE TABLE "USERS"
    (     "USERID" VARCHAR2(8 BYTE),
         "PASSWORD" VARCHAR2(50 BYTE),
         "FIRST_NAME" VARCHAR2(50 BYTE),
         "LAST_NAME" VARCHAR2(50 BYTE),
         "SITE_ID" VARCHAR2(5 BYTE),
         "ROLE_ID" VARCHAR2(1 BYTE)
    ) SEGMENT CREATION IMMEDIATE
    PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
    STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
    TABLESPACE "SITES_DATA_TS"
    CACHE ;
    -- DDL for Table EMPLOYEE_PROFILE
    CREATE TABLE "EMPLOYEE_PROFILE"
    (     "EMPLOYEEID" VARCHAR2(9 BYTE),
         "PROGRAM" NUMBER,
         "REQUIREMENT" NUMBER,
         "JOBNUM" VARCHAR2(50 BYTE),
         "STATUS" VARCHAR2(50 BYTE),
         "PROGRAM_TYPE" VARCHAR2(50 BYTE),
         "SITE_ID" VARCHAR2(5 BYTE),
         "NUM_QUAL_TEST_ATTEMPTS" NUMBER(7,0)
    ) SEGMENT CREATION IMMEDIATE
    PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
    STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
    TABLESPACE "SITES_DATA_TS"
    CACHE ;

  • Delta Calculation and Updating multiple tables

    We pull data from a System of Records table that contains the most up to date information. The information changes daily so we have a delta process to identify what new records were added, which records were deleted (records that are not found in the table as compared to yesterday) and which were updated. Delta process compares the already loaded data with the newly updated SOR data to find the differences.
    Once the delta is established, either new records get added or existing records get updated or existing records are marked as inactive (Deletes). Additions and Updates generally happen across multiple destination tables.
    Updates are identified by looking at different columns to see if any one column is changed. These columns end up in different tables.
    Example
    Source Delta Table, S1
    ID COL1 COL2 COL3 ACTION
    1 abc xyz pqr A
    2 bcd lmn def U
    S1.Col1 maps to Destination Table D1.Col23
    S1.Col2 maps to Destination Table D2.Col45
    S1.Col3 maps to Destination Table D3.Col11
    Currently all tables are updated irrespective of whether the relevant data has changed or not (All 3 destination tables are updated).
    I would like to know which of the Columns for a given row has changed values so that I can update only the relevant tables.
    Thus if additional columns are available that act as flags
    Source Delta Table, S1
    ID COL1 COL2 COL3 ACTION COL1 COL2 COL3
    1 abc xyz pqr A - - -
    2 bcd lmn def U N Y N
    3 kjh qwe iop U Y Y N
    then for incoming ID=2, I just have to update Destination Table D2 and not D1 and D3
    for incoming ID= 3, I have to update Destination Tables D1 and D2 but not D3.
    How can I achieve that?
    This is mainly to improve performance as the processing time is very short - Faster the delta processing, better will it be.
    Thanks in advance.

    Thanks for your response.
    My question was more towards establishing what has changed.
    Given a table, which is updated daily, how does one efficiently establish which data has changed?
    Here is an example to clarify my question further
    The Source table has the following data on a particular day
    Data in Source table on Monday               
    ID     Col1     Col2     Col3
    1     abc     bcd     cde
    2     def     efg     fgh
    3     ghi     hij     ijk
    4     jkl     klm     lmn
    Copy of the above data is stored in a Old Data table
    Data in Source table on Tuesday               
    ID     Col1     Col2     Col3
    1     bac     bcd     cde
    2     def     gfe     fgh
    3     ghi     jih     jik
    5     mno     nop     opq
    Data in Source Table is compared with data in Old Data Table
    Delta established by comparing Source Table with Old Data Table                    
    ID     Col1     Col2     Col3     Delta_Flag
    1     bac     bcd     cde     U
    2     def     gfe     fgh     U
    4                    D
    5     mno     nop     opq     A
    Rows with IDs 1 & 2 were updated - thus to be updated
    Row with ID 3 - no change so not seen in delta
    Row with ID 4 was not found - thus to be deleted
    Row with ID 5 was new - To be added
    I can do the above easily. I would like to a step further to be able to say for updates
    Row with ID 1 has Col1 changed
    Row with ID 2 has Col2 and Col3 changed
    Is there an easy way to do this?

  • Updating multiples tables

    Hi ,
    i want to update two tables
    ALTER PROCEDURE [dbo].[SP_updateDetails]
    -- Add the parameters for the stored procedure here
    @ServiceID int,
    @DayoftheWeek varchar(50),
    @Date datetime,
    @Services varchar(50),
    @Venue varchar(50),
    @ProjectName varchar(50),
    @StartTime varchar(50),
    @EndTime varchar(50),
    @Breakfast varchar(50),
    @Lunch varchar(50),
    @Dinner varchar(50),
    @Total varchar(50),
    @HoursTotal varchar(50)
    AS
    BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON;
    -- Insert statements for procedure here
    update DetailsTable set Services=@Services,Venue=@Venue,ProjectName=@ProjectName,StartTime=@StartTime,
    EndTime=@EndTime,Breakfast=@Breakfast,Lunch=@Lunch,Dinner=@Dinner,Total=@Total,HoursTotal=@HoursTotal where ServiceID=@ServiceID and DayoftheWeek=@DayoftheWeek
    END
    ALTER PROCEDURE [dbo].[SP_TimeSheetMain_Insert]
    @EmpID int,
    @EmpName varchar(50),
    @StartDate datetime,
    @EndDate datetime,
    @date datetime,
    @day varchar(50),
    @Service nvarchar(max),
    @Venue varchar(50),
    @StartTime varchar(50),
    @EndTime varchar(50),
    @Breakfast varchar(50),
    @Lunch varchar(50),
    @Dinner varchar(50),
    @DailyTotal varchar(50),
    @Total varchar(50)
    AS
    BEGIN
    insert into EmpTimesheet(EmpID,EmpName,StartDate,EndDate,date,day,Service,Venue,StartTime,EndTime,Breakfast,Lunch,Dinner,DailyTotal,Total
    ) values (@EmpID,@EmpName,@StartDate,@EndDate,@date,@day,@Service,@Venue,@StartTime,@EndTime,@Breakfast,@Lunch,@Dinner,@DailyTotal,@Total
    END
    If i update anything in details table i want to update it into emptimesheet table .Do i need to write another update statement in updatedetails storedprocedure or any other ways that i can simply update emptimesheet.

    Are you looking for a permanent way to update table B each time you are updating table A? In other words, any update of table A will lead to an update of Table B? Or sometimes you need to update the tables without dependency?
    For clarification, A trigger is a database element, which execute on a specific event (therefor the name trigger, as the event trigger the action). Once you created a trigger (and it is enable) it will execute on that even every time! In this case Visakh16
    suggested the use of trigger which will execute on any update event. I just want to clarify if that is what you want, then this is the answer, but if you need some times to use update without dependency and sometimes with dependency, then you can use a simple
    query without creating new element on the database, with using an 'OUTPUT INTO'. It will not fit any DDL, but this is very fast and easy way to insert data into table B using an update statement
    on table A.
    Unfortunately you did not post a DDL+DML, and i dont want to do it for all the columns in your query, therefor i will demonstrate using two simple tables. I hope you will be able to implement this on your table. If you dont, then please post DDL+DML.
    Check is this sample code help you:
    use QQ
    go
    CREATE TABLE TableA (
    TableAID INT PRIMARY KEY,
    TableAName NVARCHAR(10)
    CREATE TABLE TableB (
    TableBID int,
    TableBName NVARCHAR(10)
    GO
    select * from TableA
    select * from TableB
    GO
    insert TableA values (1, 'a')
    GO
    update TableA
    set TableAID = 2, TableAName = 'b'
    OUTPUT INSERTED.TableAID,inserted.TableAName INTO TableB
    select * from TableA
    select * from TableB
    GO
    DROP table TableA
    DROP TABLE TableB
    GO
    this is the main Idea:
    update TableA
    set TableAID = 2, TableAName = 'b'
    OUTPUT INSERTED.TableAID,inserted.TableAName INTO TableB
    I hope this is helpful :-)
    [Personal Site] [Blog] [Facebook]

  • Is it possible to update multiple tables with a dynamic form?

    I have columns from two tables populating a dynamic form. I am trying to have the form update both tables on submit. I have tried both a linked transaction and a custom transaction but I am not making progress. Only the master table is being updated. Is it possible with ADDT to update two tables with a dynamic form?

    I meant
    SXMSMSTAT
    SXMSSYERR
    Thanks.

Maybe you are looking for

  • Delivery document creation after Posting of Goods through Purchase Order

    Dear All, Could you please help me out by letting me know how to create a delivery document flow i.e. entry in VBFA table after Posting of Goods through PO, I have Inbound delivery document that I know & also a succssfull Material document that is cr

  • How to list sorted files in a folder?

    I am in need of creating a java program which should perform the following. 1. Read ALL the files located under c:\main dir 2. Append the read files into a Email.log file in the order in which the files are created. For example: main directory has th

  • Issues with their Chinese or Japanese characters while sending mail

    Hi All , I am sending mail using FM SO_DOCUMENT_SEND_API1. I am facing problem with display of chinese and japanese character in mail attachment. For example , Data in ABAP table 延平路123弄1号10A is converted to ösï721_ 3S÷83L in excel sent via mail thr

  • Jco report error

    when i use jco to connect r3,call bapi "BAPI_DOCUMENT_CHECKOUTVIEW2" it reports the following errors: com.sap.mw.jco.JCO$AbapException: (126) NO_DOC_TYPE: NO_DOC_TYPE      at com.sap.mw.jco.JCO$Function.getException(JCO.java:18195)      at com.sap.mw

  • Content Repositories OAC0 - Transport

    Hi We have separate dev and production Content Servers.. What is the practice followed in creating content repositories in Production server?? Is it transported from dev ?. Or do we have to create it freshly in the production server?? If i try to tra