Database table wrongly update

Hi team,
I have one big production database; under this production database one very important table is there.
Here I am updated the table wrongly, but I have table backup before updating  the table.
Here how we can restore the backup table into old backup table.

In your case, Its better to use the same condition to update the value from backup tables by joining the columns on a key combination.
update T1
set T1.<column1>=T2.<column1>,
T1.<Column2>=T2.<Column2>
FROM <TableName> T1 INNER JOIN <Table_Backup> T2 on T1.id=T2.id
Where t1.id between 100 and 1000
OR
If there are no inserts/updates/deletes happen after the change, then you can try dropping the original table and rename the backup table by re-creating all the metadata
-Prashanth

Similar Messages

  • Check which column in database table is updated without hard code

    Hi ,
    I have a requirement to detect if there is a particular column in the database table is updated , and this column name is found in mapping table ( business logic ) , it will do an insertion to another special table.
    My idea is to introduce a trigger before update or delete on this table
    However , i would like to make it as dynamic as possible
    i dont want to use things as below in trigger if possible
    1. if ( old.name <> new.name ) then {
    if( 'name' is inside the mapping table ) {
    // do some insertion
    I want things like
    2. if ( there is a column updated on this table ){
    1. select column name and updated value that is updated
    2. if the column name that is updated is inside the mapping table {
    // do some insertion
    I am not really sure if the pseudo code listed in no 2 is achieveable in oracle using simple pl/sql or sql ?
    if possible , how to do it ?
    Thanks

    Hi,
    Check the link given below
    http://download.oracle.com/docs/cd/B10501_01/appdev.920/a96590/adg13trg.htm
    and search for
    IF UPDATING THEN*009*

  • File to rfc...database tables not updated ??

    Hi XI Friends..
    in my File to BAPI..
    it is successfully executed..and it is showing chequered glag in sxmb_moni..and also in runtime workbench it is showing success..but the database tables are not updating..
    i gone thru the link.. reciver rfc adapter..
    http://help.sap.com/saphelp_nw04/helpdata/en/c8/e80440a832e369e10000000a155106/frameset.htm
    now i am working on SP 17.
    so how can i set the values in ...
    <i>Commit Control for Individual BAPI Calls</i>and
    <i>BAPI Advanced Mode.
    In the Successful RETURN-TYPE Values table, what values i have to enter that should lead to a successful execution</i>
    its Asyncronous call..
    in standard BAPI ther is no commit.
    please tell me ..what values in need to give to update database tables..instead of RFC wrapper..
    regards
    ram

    Hi Friends..
    i created ZRFC and in that rfc i given standard bapi and commit work..
    i tested in sap ..the table is updating..
    thru XI..the table is not updating...
    it showing likw this..in receiver rfc adpater monitering...
    <i>Receiver channel 'CC_IN_SAP_WorkOrderCompletion' for party '', service 'SAP_ERP_DEV' (internal name 'RfcClient[CC_IN_SAP_WorkOrderCompletion]')
    Client data: {jco.client.lang=EN, jco.client.snc_mode=0, jco.client.client=400, jco.client.passwd=******, jco.webas.ignore_jdsr_error=1, jco.client.user=aar, jco.client.sysnr=10, jco.client.ashost=53.249.196.86}
    Repository data: {jco.client.lang=EN, jco.client.snc_mode=0, jco.client.client=400, jco.client.passwd=******, jco.webas.ignore_jdsr_error=1, jco.client.user=aar, jco.client.sysnr=10, jco.client.ashost=53.249.196.86}
    Current pool size: 1, maximum pool size : 1
    Channel History
    - OK: 2006-12-19 11:12:58 CET: Message processed for interface ZBAPI_ALM_CONF_CREATE</i>
    and in messagemonitering audit log..
    <i>2006-12-19 11:12:58 Success Message successfully received by messaging system. Profile: XI URL: http://dcexi0602.alcan.com:50000/MessagingSystem/receive/AFW/XI Credential (User): XIISUSERDGX
    2006-12-19 11:12:58 Success Using connection AFW. Trying to put the message into the receive queue.
    2006-12-19 11:12:58 Success Message successfully put into the queue.
    2006-12-19 11:12:58 Success The message was successfully retrieved from the receive queue.
    2006-12-19 11:12:58 Success The message status set to DLNG.
    2006-12-19 11:12:58 Success Delivering to channel: CC_IN_SAP_WorkOrderCompletion
    2006-12-19 11:12:58 Success RFC adapter received an asynchronous message. Attempting to send tRFC for ZBAPI_ALM_CONF_CREATE with TID XIVqvZy8z94TkgWVR9u01m0m
    2006-12-19 11:12:58 Success The message was successfully delivered to the application using connection AFW.
    2006-12-19 11:12:58 Success The message status set to DLVD.
    </i>
    but the table is not updating...
    please guide me..
    regards
    ram

  • Database table not updating

    Hi all,
    I am updating the database table with following syntex, but table not updating.
    MODIFY ZTEST_BAR FROM TABLE I_ZTESTBAR.
    Please help.
    PKB

    Hi,
    firstly you can define internal table and work area as below:-
    internal tables
    DATA : I_ZTESTBAR TYPE TABLE OF ZTEST_BAR.
    work areas
    DATA : I_ZTESTBAR_LINE LIKE LINE OF I_ZTESTBAR .
    here internal table having the same structure as that of ztable which include MANDT.
    Then to update field, you can use add following code:-
    *Update Ztable
    INSERT INTO ZTEST_BAR VALUES I_ZTESTBAR_LINE.
    COMMIT WORK.
    Hope this works for you.
    Thanks..........

  • Add entries to database tables using update function module

    Hi All,
    I have a small requirement, in which I need to update Z-tables usimg update function module in update task. In the calling program, I have gathered the data in a field symbol value of type any. I need to pass the same to that function module to update the data which is in the field symbol.
    Please guide me how to achieve this technically.
    Thanks in advance,
    Pradipta .

    Hi,
    I believe you already have evrything with you.....Start Coding the same and come back with any Coding issue.
    I believe you will not be able to pass the Field Symbol in FM Interface.....You need to pass the Variable which Field Symbol is referring....

  • File to rfc...database tables not updating

    Hi friends..
    in file to bapi ..
    created ZRFC and in that rfc i given standard bapi and commit work..
    i tested in sap ..the table is updating..
    thru XI..the table is not updating...
    it showing likw this..in receiver rfc adpater monitering...
    <i>Receiver channel 'CC_IN_SAP_WorkOrderCompletion' for party '', service 'SAP_ERP_DEV' (internal name 'RfcClient[CC_IN_SAP_WorkOrderCompletion]')
    Client data: {jco.client.lang=EN, jco.client.snc_mode=0, jco.client.client=400, jco.client.passwd=******, jco.webas.ignore_jdsr_error=1, jco.client.user=aar, jco.client.sysnr=10, jco.client.ashost=53.249.196.86}
    Repository data: {jco.client.lang=EN, jco.client.snc_mode=0, jco.client.client=400, jco.client.passwd=******, jco.webas.ignore_jdsr_error=1, jco.client.user=aar, jco.client.sysnr=10, jco.client.ashost=53.249.196.86}
    Current pool size: 1, maximum pool size : 1
    Channel History
    - OK: 2006-12-19 11:12:58 CET: Message processed for interface ZBAPI_ALM_CONF_CREATE</i>
    and in messagemonitering audit log..
    2006-12-19 11:12:58 Success Message successfully received by messaging system. Profile: XI URL: http://dcexi0602.aaaa.com:50000/MessagingSystem/receive/AFW/XI Credential (User): XIISUSERDGX
    2006-12-19 11:12:58 Success Using connection AFW. Trying to put the message into the receive queue.
    2006-12-19 11:12:58 Success Message successfully put into the queue.
    2006-12-19 11:12:58 Success The message was successfully retrieved from the receive queue.
    2006-12-19 11:12:58 Success The message status set to DLNG.
    2006-12-19 11:12:58 Success Delivering to channel: CC_IN_SAP_WorkOrderCompletion
    2006-12-19 11:12:58 Success RFC adapter received an asynchronous message. Attempting to send tRFC for ZBAPI_ALM_CONF_CREATE with TID XIVqvZy8z94TkgWVR9u01m0m
    2006-12-19 11:12:58 Success The message was successfully delivered to the application using connection AFW.
    2006-12-19 11:12:58 Success The message status set to DLVD.
    please help me..
    regards
    ram

    Hi Sravya..
    yes i given commit work after bapi in ZRFC..
    in SAP..i tested ..its updating...but thru XI..
    it is showing success..
    but its not updating tables...
    thanks for your response
    regards
    ram

  • Error in updating custom database table using UPDATE SET Command

    Hi,
    I developed an automated collection system program in one of our clients simulating FBE1 (Payment Advice Creation) and F-28 (Posting of Incoming Payments) transaction codes. Upon posting, we encountered an error in PRD server wherein, for some of the posted items, the STATUS field in our custom table was not successfully updated. We tried to reverse the clearing document and debug the program. Upon posting, we were able to successfully update the status. We could not simulate the error in QAS since all the postings in QAS were successful and all status' relating to these postings were updated as well. We tried posting multiple times and the program seems to be working fine. In PRD, this behavior is just random and there is no specific pattern as to how the error occured. Provided below is the code I used for updating custom table ZFIACSF28. The STATUS field should be equal to '4' once the posting is successful. We are not sure if this is a database related issue. 7 users are authorized to do the postings in PRD and they are using the same user account.
    CODE:
      CALL TRANSACTION 'F-28' USING gt_bdcdata
                              MODE   'E'
                              UPDATE 'S'
                              MESSAGES INTO gt_messtab.
      READ TABLE gt_messtab INTO wa_messtab WITH KEY msgtyp = 'S'
                                                     msgnr  = '312'.
      IF sy-subrc EQ 0.
    update status for items cleared bearing the same OR Number*
        UPDATE zfiacsf28 SET status       = '4'
                             zsapdocument = wa_messtab-msgv1(10)
                             zruntime     = sy-uzeit
                             zrundate     = sy-datum
                       WHERE zor          = gv_zor
                       AND   customer     = gv_customer.
        COMMIT WORK.
    ENDIF.

    Hi,
    it's not possible that status isn't updated in zfiacsf28 while date and time are updated there, because it's hard coded.
    There must be other programs that also change your table zfiacsf28 and maybe clear those fields. Maybe the key fields zor and customer cannot provide  duplicate access, what is the meaning of field zor ?
    Please check the where used list of table zfiacsf28 to find other update programs.
    Regards,
    Klaus

  • Database table not updating with the changes

    Hi friends,
                    Iam having a tablecontrol where iam gettting the data from the ztable for a particular key field.  When i change certain fields in the table control and when i click save, it should update the changes in the ztable.
       module save output.
       modify zslip_po1 from table x_po1_slip.
    here slpno is the key field.  if I change a field for a particular slpno it should update the changes for that slpno value only.
    but it is not updating the changes. although iam setting the slpno field dynamically.
    Please give me ideas.
    thanks and regards
    Murali Krishna T

    Hi,
    1. Have 2 Internal Tables, the first one must contain the original data(before change ) and the second one  contains the update data(after changed ie. table control data).
    2. loop the first table and read the data from the second table using index.
    3. inside the loop, compare the work area of both the internal table.
       if both are same, then no change was made to that particular record, so no need for updation
       if both are not same, then some changes were made on that record, so need to update.
    4. use modify command to update that particular record from the work area.
    i think in performance wise also this logic will be helpful, since we are updating only the changed record.
    since this is addon table, so i hope the no of records will also less, so no need to worry about loop.
    check with this, it may work out......
    thank you,
    SenthilPandi C
    Edited by: SenthilPandi ChandraSekaran on Feb 4, 2010 5:36 PM

  • RG1 table wrong updation

    Material document was posed  with posting date 31.03.2009 on 04.04.2009,  movement type 711 and 712 for financial year stock variance posings.
    But the J1irg1 is getting upated with register year 2009 instead of 2008.
    The material doucment in 2009, but the excise records are financial year basis. This material document has to be posted in Financial year 2008-09, the registering year should be 2008.
    Please advise.
    Regards
    Srinivas.

    Excise records gets updated on system date. We had the same problem when we were posting MIGO in back date i.e in 31.03.2009 was getting posted on entry date of 02.04.2009.

  • Database table update issue

    Hello experts, Need your Help...
    I am trying to update database table using Update command. And I am doing COMMIT WORK AND WAIT. after the successful update.
    But my code sometimes does not work and the table is not updated.
    Sometimes the code works and sometimes not.. for the same data.
    Can anybody think of any possible reason?
    Thanks in advance,
    --Kumail

    Hello Guys,
    Here is the code, here we have all the keys... as it updates correctly sometimes. But doesnt update sometimes... for same data...... I have added COMMITT and WAIT statements to solve this problem.... but no luck....
            UPDATE zfxx_bsr_data
                SET zfxxstatus_glr  = zfxx_bsr_data-zfxxstatus_glr
                zfxxstatus_issue = zfxx_bsr_data-zfxxstatus_issue
                    zfxxerdat_glr   = sy-datum
                    zfxxuser_glr    = sy-uname
                    zfxxremark_glr  = zfxx_bsr_data-zfxxremark_glr
                    zfxxertime_glr  = sy-uzeit
                  doc_ind         = w_doc_ind                  
                  zfxx_attach_acc = w_zfxx_att_acc      
              WHERE bukrs        EQ t001-bukrs
              AND   saknr        EQ zfxx_bsr_data-saknr
              AND   zfxxperiod   EQ zfxx_bsr_data-zfxxperiod
              AND   zfxxfield    EQ c_ba
              AND   zfxxfieldval EQ tgsb-gsber.
            IF sy-subrc EQ 0.
              WAIT UP TO 3 SECONDS.
              COMMIT WORK.
              WAIT UP TO 3 SECONDS.
            ENDIF.

  • Unable to update or insert into Access database table using OleDB, and it doesn't return any errors.

    I'm new to VS. I have run the following code. It does not produce any error, and it does not add or update data to my Access database table.
    dbUpdate("UPDATE prgSettings SET varValue='test' WHERE varSetting='test'")   
    Function dbUpdate(ByVal _SQLupdate As String) As String
            Dim OleConn As New OleDbConnection(My.Settings.DatabaseConnectionString.ToString)
            Dim oleComm As OleDbCommand
            Dim returnValue As Object
            Dim sqlstring As String = _SQLupdate.ToString
            Try
                OleConn.Open()
                MsgBox(OleConn.State.ToString)
                oleComm = New OleDbCommand(sqlstring, OleConn)
                returnValue = oleComm.ExecuteNonQuery()
            Catch ex As Exception
                ' Error occurred while trying to execute reader
                ' send error message to console (change below line to customize error handling)
                Console.WriteLine(ex.Message)
                Return 0
            End Try
            MsgBox(returnValue)
            Return returnValue
    End Function
    Any suggestions will be appreciated.
    Thanks.

    You code looks pretty good, at a quick glance.  Maybe you can simplify things a bit.
    For Insert, please see these samples.
    http://www.java2s.com/Code/CSharp/Database-ADO.net/Insert.htm
    For Update, please see these samples.
    http://www.java2s.com/Code/CSharp/Database-ADO.net/Update.htm
    Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.
    Best to keep samples here to VB.NET
    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem.

  • Logical database table

    How to update the logical database table.Please explain with a code

    this is how you can update the database table .
    UPDATE it_tab
          set   MSIZE =  MSIZE
                LENGTH = LENGTH
                COILS =  COILS
                SPOOLS = SPOOLS
                WEIGHT = WEIGHT
      where SRNO =  SRNO and
            DDATE = DDATE   AND
            SHIFT = SHIFT AND
            PLANT = PLANT  .
    but please post detail description of the problem whn u post in forms
    Thanks
    -Ankit

  • Regarding database table to infotype

    hi experts,
                    sorry i m going to ask a typical question i m working on hr-abap ,i have developed a module pool in which the database table is updating with some data,what i want that after updation i want to store that data in a infotype,,so plz tell me how to create infotype and how to store the data into it from a database table...thnx in advance.i know it is a configuration part but rt nw my company doesnt have hr consultant.....plz help me.

    Hi
    <b>Creating an Infotype</b>
    Using the TCODE PM01 you can create an Infotype. As per SAP standard you can use only 9000 series. The below procedure explains you how to create an Infotype.
    1.Go the transaction PM01 and give the Infotype Number lets say 9999 and press  button. It will ask you a messaging window,
    2.Press create button to continue further. It will take you to create the structure.
    3.Give the components and SAVE & ACTIVATE the structure and come back.
    An Infotype attributes window will appear; you create a new entry with the Infotype No and give the appropriate description.
    and give the data and press ENTER key. The Technical data will appear automatically, here you have to maintain the Single screen as ‘2000’ and List screen as ‘3000’ and then SAVE the info and press BACK button, you will reach the main screen.
    After that using the Menu option Infotype 
    4.Generate the structure, dialog module and include. 
    Click the  button from application tool bar to check the Infotype attributes. Select the 9999 Infotype and check the data.
    If every thing is error free, you can use the Infotype using PA30 transaction.
    5.Use the Create button you can create New Entries for the Infotype.
    You can view the entries in table PA9999 using the TCODE SE11/SE16.
    Validating Code in Module pool: - If you want to validate the user inputs,
    You need to write the validate code procedure in the module program MPXXXX00 screen 2000 (here XXXX is user Infotype, in our case 9999).
    In PAI.
      MODULE P9999.
      MODULE HIDDEN_DATA.
      FIELD P9909-PRATE MODULE PRATE. “ Create a module routines. 
    In PBO
      MODULE PRE_INPUT_CHECKS.
            input-checks:                                               *
      insert check modules here:
      CHAIN.
       FIELD P9909-PRATE MODULE PRATE.
      ENDCHAIN.
    Double click on PRATE it will ask you the include name, SELECT the include MP999930 from the input window.
    *&      Module  PRATE  OUTPUT
          text
    MODULE prate OUTPUT.
      IF NOT p9909-prate IS INITIAL.
        PERFORM check_prate.
      ENDIF.
    ENDMODULE.                 " PRATE9  OUTPUT
    Again check_prate subroutine, write down the below code in MP999940 include.
    *&      Form  check_prate
    FORM check_prate .
    CLEAR zprate_t.
      SELECT SINGLE * FROM zprate_t WHERE prate = p9909-prate.
      IF sy-subrc > 0.
        CLEAR zprate_t.
        MESSAGE e016(rp) WITH 'Entry does not exist in ZPRATE_T table'.
      ENDIF.
    ENDFORM.                    " check_prate
    After that check the module, if it is error free then ACTIVATE the same. You can check the Infotype validations using the PA30 transaction.
    Regards
    Raj

  • Listen to a database table (inserts, deletes etc)?

    Hi,
    is there a chance to listen for a database table for updates?
    The programm should not stress the system. I'm looking for something like a listener in JAVA.
    Thank You!

    Wow! Two development systems, a dream for many! I now see your dilemma. I don't think this can be resolved by an IT solution. You need a project management solution. Your project managers who oversee the developers and configurators on both systems should come up with a strategy of not to step on each other toes. Let us say one works on SD configuration on one system and other works on MM configuration on another. That way they will not be doing the same thing. Then there will be those touch/integration points where there should be clear cut guideline as to who does what. As far as developers are concerned, they should also have clear naming standards and should follow them.
    I am curious as to why you have two development systems. Will it not lead to duplication of work(as you see now). Then there will be the problems of one overwriting the work of others. Even if two seperate projects are in development on two different boxes, if both need to configure the same activity but different way, will it not lead to one overwriting others work?
    How are you keeping the two development environments in sync with each other? Is the purpose of two development environments is to do independent developments or is it to just provide more bandwidth and power. If it is the second reason, then have you tried a landscape similar to most production systems, where there will be multiple servers working, yet sharing the same database(distributed architecture)? If it is the first, then proper guidelines and naming standards should avoid most of those situations.
    Even, the enqueuing strategy you are looking for will be difficult to design. If you look at SPRO, there are at least 100 tasks that you can do there, and some thousands of tables will be there behind those tasks, so how are you design your enqueue table, by task or by individual table? Add to the mix the development objects, it becomes even more complicated and don't forget basis and security changes. If you design your enqueue table based on the transport objects, it will be difficult to know the content of the transport, excepts at a metadata level. Also, can you imagine how much space this table(s) going to take up?
    So many questions, but no answers. A technical solution is not necessarily always the best solution, even though I am technical person!!! Either your scope should be very limited to do such a thing, or you should tackle it with non-technically, standards, procedures and guidelines.
    Regards,
    Srinivas

  • Not updating database table after editing using theADFapplicationJdev10.1.3

    Hi
    I created the Sample Browse and Edit JSF JSP page oracle ADF application as explained in the cuecards in Jdev10.1.3.
    After editing the department table rows in browser i am checking the database tables for the changes.
    But my table are still with the old data.they are not updating with the values i changed in the browser.
    i followed the steps correctly as explained in cuecards.
    where i am going wrong.
    What i have to do to commit the changes in to database in my ADFApplication.Did i need anything to add my code.

    In Jdev 10.1.3,there is no operations folder directly under the Application data module control.
    there is only constructors,merge entity,persist entity,refresh entity,remove entity and findalldepartments(),findallemployeeas() nodes under the application data module control.
    In findalldepartments,findallemplloyees the operations node is there.under that i don't have the commit .i have only create,execute,first,previous,last,next,delete,removerowwithkey,setcurrentRowWithkey,setcurrentRowWithkeyValue under the operation node.
    so how can i commit the operations in database.
    Please help me.

Maybe you are looking for

  • App store keeps asking for my credit card info for free apps!??

    Every time I go to get a free app, I keep getting asked for my credit card info to be updated. If it's free, why is my credit card info needed!?? I don't want to get charged, so I cancel out of the credit card request, it's not worth trying to get un

  • Weird Pop-up window asking for password.

    I have an iPhone 3gs (I know, I know...I'll upgrade soon!) and lately a window pops up (constantly) that asks for my password for a Yahoo account that I don't recognize...am I being "hacked"? - or at least is someone trying? Kind of freaking me out.

  • SQL Query without using Pivot...

    Hi Guys, Need help with a query... I think pivot table is the way to go but don't wanna to use it as it is not supported in Oracle 10g. Sample data set... Part Section A001 AC A001 AY A001 AN A001 AX A015 AC A015 AR A007 AC A008 AN A008 AX A008 AE A0

  • Can't authorize Facebook exports from Lightroom

    Ever since the sun shined and Lightroom 3.0 came out, I have been using its fabulous publish servces.  I haven't had any trouble with my Facebook connection until I rebuilt my computer and reinstalled Lightroom.  Doing so required me to reauthorize L

  • Report's HTML ouput via Email

    Hi falks! We are facing the issue that when we try to send a report via Email in HTML format it does not export table borders. Any idea about this issue? Any help will be appreciated! Thanks for your time. Regards, Ariel