Delete all the database table content

Hello Friends,
I have a z table with 5 fields (all the key fields) and I want to delete all the table content and load fresh content from internal table.
I tried using syntax 'delete ztable' but sy-subrc value is coming as 4, means no table content is getting deleted.
Please suggest me any alternative way to delete all the database table content.
Thanks in advance,
Shreekant

Hi,
try using
delete from ztable.
This will delete all records from your ztable. After this command u can fill your ztable from itab by the following command
select *
from std table
into corresponding fields of itab.
insert ztable from table itab.
Hopefully this will solve your problem.
Regards,
Ibrar

Similar Messages

  • Export all the database tables into CSV

    I am using Oracle 10 g Release 2
    I need to expot all the database tables off of an oracle schema to it's corrosponding CSV files.
    Can I use 'EXP U_name/pswd GRANTS=Y TABLES=(table_A,table_B,table_C)' .?
    Any advise is a plus.
    Thanks in advance
    Jay

    Pl post OS and database versions.
    If you have access to execute database export utilities, then use the TABLES parameter as you have indicated
    exp - http://docs.oracle.com/cd/E11882_01/server.112/e22490/original_export.htm#sthref1927
    expdp - http://docs.oracle.com/cd/E11882_01/server.112/e22490/dp_export.htm#sthref135
    HTH
    Srini

  • Delete all the entries in target table when message mapping?

    Hello Gurus,
    I have a requirement in the project. When I do message mapping, I need to delete all the entries in the target table and then insert the new rows. From searching the old posts, I know it is possible without BPM. Can anyone please help me out? I really appreciated it.
    Regards,
    Bai

    Hi Bai,
    Check the below links:
    http://help.sap.com/saphelp_nwpi711/helpdata/en/43/9519abb1146353e10000000a11466f/frameset.htm
    Defining a DELETE Statement 
    http://help.sap.com/saphelp_nwpi711/helpdata/en/44/7b6e85fde93673e10000000a114a6b/content.htm
    Thanks,

  • Update the database table with the content of the internal table

    Hello!
      I have the next form:
      FORM erase_data.
    SELECT * FROM zadrress INTO CORRESPONDING FIELDS OF TABLE itab_adrress.
      DELETE TABLE itab_adrress: FROM zadrress,
                                 WITH TABLE KEY adrid = '456'.
      WRITE 'The information after the DELETE operation'
      COLOR 2.
      LOOP AT itab_adrress INTO wa_adrress .
        WRITE:/
               wa_adrress-adrid COLOR 5,
               wa_adrress-name COLOR 7,
               wa_adrress-email COLOR 5,
               wa_adrress-depart COLOR 7,
               wa_adrress-display COLOR 5.
      ENDLOOP.
      SKIP.
    LOOP AT itab_adrress INTO wa_adrress.
       MODIFY zadrress FROM wa_adrress.
       COMMIT WORK.
       IF sy-subrc = 0.
         WRITE 'OK !'.
         SKIP.
       ELSE.
         WRITE 'FAIL !'.
         SKIP.
       ENDIF.
    ENDLOOP.
      MODIFY zadrress FROM TABLE itab_adrress.
      UPDATE zadrress FROM TABLE itab_adrress.
    TRANSPORTING adrid, name, email, depart, display.
    INSERT zadrress FROM TABLE itab_adrress ACCEPTING DUPLICATE KEYS.
    PERFORM display_data .
    ENDFORM.                    "erase_data
    I see that my record is deleted  when I display the records from my internal table, but
    now I want to delete the record from database table.
       For that I want to move the content of the modified internal table in the database table. You can see the methods I tried (some of them commented), but nothing seems to work.
    Any advice ?
    Thank you.

    FORM erase_data.
    SELECT * FROM zadrress INTO CORRESPONDING FIELDS OF TABLE itab_adrress.
    DELETE TABLE itab_adrress: FROM zadrress,
    WITH TABLE KEY adrid = '456'.
    WRITE 'The information after the DELETE operation'
    COLOR 2.
    LOOP AT itab_adrress INTO wa_adrress .
    WRITE:/
    wa_adrress-adrid COLOR 5,
    wa_adrress-name COLOR 7,
    wa_adrress-email COLOR 5,
    wa_adrress-depart COLOR 7,
    wa_adrress-display COLOR 5.
    ENDLOOP.
    SKIP.
    LOOP AT itab_adrress INTO wa_adrress.
    MODIFY zadrress FROM wa_adrress.
    COMMIT WORK.
    IF sy-subrc = 0.
    WRITE 'OK !'.
    SKIP.
    ELSE.
    WRITE 'FAIL !'.
    SKIP.
    ENDIF.
    ENDLOOP.
    <b>DELETE FROM zadrress.</b>  "Make this change and try
    MODIFY zadrress FROM TABLE itab_adrress.
    UPDATE zadrress FROM TABLE itab_adrress.
    TRANSPORTING adrid, name, email, depart, display.
    INSERT zadrress FROM TABLE itab_adrress ACCEPTING DUPLICATE KEYS.
    PERFORM display_data .
    ENDFORM. "erase_data'.

  • Can I restore the deleted statistical data from the database tables?

    Hi all,
       I have deleted the statistical data from the database tables like(Ex: RSDDSTAT, RSDDSTATWHM,..) by mistake through RSA1> Tools> BW Statistics for Infoproviders--> Delete.
    Is there any way to restore the deleted data back? Thanks in advance.

    Now I'm really confused-
    Your first post said
    "<b>I have deleted the statistical data from the database tables like(Ex: RSDDSTAT, RSDDSTATWHM</b>,..) by mistake through RSA1> Tools> BW Statistics for Infoproviders--> Delete."
    but your last respsonse said
    "I have deleted the BW Statistics data, <b>not the actual data in RSDDSTAT tables</b> through
    RSA1 -> Tools -> BW Statistics for InfoProviders -> clicked 'Delete' bin to delete data."
    If you used the RSA1 -> Tools -> BW Statistics for InfoProviders -> clicked 'Delete' - <b>then you deleted the data from the RSDDSTAT tables</b>. This assumes you accepted the default date range that would have popped up after the clicking on the Delete button which specified to delete thru the current date.  If this is what you did, the data is gone.  Your only hope is be to recover from a DB backup.  
    The data in the RSDDSTAT tables is what is used to feed the BW Statistics cubes, generally on a daily basis.

  • Deletion of data within the database tables

    The user is trying to clean up the 2014 data within the database tables. He is running a delete function which keeps causing the log files
    to exceed their limit. The tables are large and he is unable to delete the data in one command due to available size and logging. What is the best way to approach this?
    Thanks,

    Hi venkatesh1985,
    According to your description, the user fails to delete data in tables due to the limited space of log file. Based on my research, this issue could occur when you use the delete statement(DELETE FROM ExampleTable) in a single transaction and consume all
    available space on your transaction log disk.
    To avoid this issue, you could use the two methods below to delete the data.
    1. Use a loop combined with TOP and delete rows in smaller transactions as the following example. This method requires you to delete all the tables one by one.
    SELECT 1
    WHILE @@ROWCOUNT > 0
    BEGIN
    DELETE TOP (1000)
    FROM LargeTable
    END
    For more information about the process, please refer to the article:
    http://dbadiaries.com/how-to-delete-millions-of-rows-using-t-sql-with-reduced-impact
    2. If you want to delete all the data from all tables in the specific database, you could script the entire database and all database objects. Then drop the database and recreate it using the script as the steps below.
    a. In Object Explorer, expand the node for the instance containing the database to be scripted.
    b. Point to Tasks, and then click Generate Scripts and click Next.
    c. Select the option of 'Script the entire database and all database objects'.
    d. Specify how scripts should be saved. You could save the script to a file or new query window. Click Next, then click ok.
    e. Drop the database, and run the script in the query window to recreate it. For more information, please refer to the article:
    http://msdn.microsoft.com/en-us/library/bb895179.aspx#Introduction
    In addition, if possible, please increase the size of the log file or move the log file to a different disk with more disk space.
    Regards,
    Michelle Li

  • Hello Anybody, I have a question. Can any of you please suggest me how to make an xml file from the database table with all the rows? Note:- I am having the XSD Schema file and the resulted XML file should be in that XSD format only.

    Hello Anybody, I have a question. Can any of you please suggest me how to make an xml file from the database table with all the records?
    Note:- I am having the XSD Schema file and the resulted XML file should be in that XSD format only.

    The Oracle documentation has a good overview of the options available
    Generating XML Data from the Database
    Without knowing your version, I just picked 11.2, so you made need to look for that chapter in the documentation for your version to find applicable information.
    You can also find some information in XML DB FAQ

  • My laptop was stolen and I need to be able to connect my iPhone4 to the new laptop and transfer content (photos, mp3's, apps etc.) to the new laptop.  I'm afraid to try a sync in case it deletes all the content off the iPhone.  Any suggestions?

    My laptop was stolen and I need to be able to connect my iPhone4 to the new laptop and transfer content (photos, mp3's, apps etc.) to the new laptop.  I'm afraid to try a sync in case it deletes all the content off the iPhone.  Any suggestions?

    You should be importing all pics taken with the iphone to your computer regularly as you would with any digital camera.
    iOS: Importing personal photos and videos from iOS devices to your computer

  • If I have to format an external hard drive to make it Mac compatible, will it delete all the content in the external hard drive?

    If I have to format an external hard drive to make it Mac compatible, will it delete all the content in the external hard drive?

    As others have said, the answer to your question is a big YES.  Formatting a drive will delete everything!
    To keep your data, yet reformat the drive for optimal Mac compatibility, you will need to:
    1) copy your files to a different hard drive (I would recommend two different locations if you value your data)
    2) repartition/format the external drive
    3) then copy the files back to the external.
    You haven't given details but if you need the external to ONLY be compatible with the Mac (and no longer care if if can be read by Windows), then you will want to partition the drive using the GUID partition scheme, and format as the (HFS+) "Mac OS Extended (Journaled)" filesystem.  You can do so using the built-in "Disk Utility" application on your Mac (in the Applications/Utilities directory).  Here are instructions:
    http://support.apple.com/kb/ph5845
    If you need the drive to be compatible with both Mac and Windows computers then please post that so someone can recommend a solution for your specific needs.

  • Request in steps in deleting all the tables data in an user schema.

    Hi Gurus,
    Could some one please provide me the steps involved in deleting all the tables data in an user(schema)
    thanks in advance

    write a script as below
    sys@11GDEMO> select 'truncate table '||owner||'.'||table_name||';' from dba_tables where owner='SCOTT';
    'TRUNCATETABLE'||OWNER||'.'||TABLE_NAME||';'
    truncate table SCOTT.DEPT;
    truncate table SCOTT.EMP;
    truncate table SCOTT.BONUS;
    truncate table SCOTT.SALGRADE;
    truncate table SCOTT.EMPBACKUP;
    truncate table SCOTT.T_NAME;
    truncate table SCOTT.D_TEMP_STSC;
    Example:
    sys@11GDEMO> truncate table SCOTT.T_NAME;
    Table truncated.
    sys@11GDEMO>

  • How to write select query for all the user tables in database

    Can any one tell me how to select the columns from all the user tables in a database
    Here I had 3columns as input...
    1.phone no
    2.memberid
    3.sub no.
    I have to select call time,record,agn from all the tables in a database...all database tables have the same column names but some may have additional columns..
    Eg: select call time, record,agn from ah_t_table where phone no= 6186759765,memberid=j34563298
    Query has to execute not only for this table but for all user tables in the database..all tables will start with ah_t
    I am trying for this query since 30days...
    Help me please....any kind of help is appreciated.....

    Hi,
    user13113704 wrote:
    ... i need to include the symbol (') for the numbers(values) to get selected..
    eg: phone no= '6284056879'To include a single-quote in a string literal, use 2 or them in a row, as shown below.
    Starting in Oracle 10, you can also use Q-notation:
    http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/sql_elements003.htm#i42617
    ...and also can you tell me how to execute the output of this script. What front end are you using? If it's SQL*Plus, then you can SPOOL the query to a file, and then execute that file, like this:
    -- Suppress SQL*Plus features that interfere with raw output
    SET     FEEDBACK     OFF
    SET     PAGESIZE     0
    -- Run preliminary query to generate main query
    SPOOL     c:\my_sql_dir\all_ah_t.sql
    SELECT       'select call time, record, agn from '
    ||       owner
    ||       '.'
    ||       table_name
    ||       ' where phone_no = ''6186759765'' and memberid = j34563298'
    ||       CASE
               WHEN ROW_NUMBER () OVER ( ORDER BY  owner          DESC
                              ,        table_name      DESC
                              ) = 1
               THEN  ';'
               ELSE  ' UNION ALL'
           END     AS txt
    FROM       all_tables
    WHERE       SUBSTR (table_name, 1, 4)     = 'AH_T'
    ORDER BY  owner
    ,       table_name
    SPOOL     OFF
    -- Restore SQL*Plus features that interfere with raw output (if desired)
    SET     FEEDBACK     ON
    SET     PAGESIZE     50
    -- Run main query:
    @c:\my_sql_dir\all_ah_t.sql
    so that i form a temporary view for this script as a table(or store the result in a temp table) and my problem will be solved..Sorry, I don't understand. What is a "temporary view"?

  • I accidentally deleted all the content on messages.

    i accidentally deleted all the content on messages. how do i get it back without getting it from a backed up hard drive?

    OK, the Mac OSX install menu came up. I'll let you know how it turns out. If it works you just saved me $50.
    Thank you for your time and consideration in this matter. Is there some way for me to post kudos for you?
    Please let me know.   :- )
    Carson  
    [email protected]

  • You can delete all the contents of my iphon

    you can delete all the contents my iphone

    That isn't a question - what do you want to do?

  • Rebuilding a locally saved mailbox deletes all the content...

    Rebuilding a locally saved mailbox from the menu deletes all the content and doesn't rebuild anything at all in OS X Mavericks Mail.app
    Can somebody try and replicate?
    Reimporting by deleting the Envelope Index seems to not import everything correctly either...
    Thank you
    MB

    This happened to me recently, deleting 8,000 messages stored on the local Inbox for one of my POP accounts. I posted a help query and nobody rose to the occasion. Is it really true that Rebuild, without so much as a warning, will permanently eradicate stored emails, essentially doing something as radical as emptying the trash, with its warning that it's not undoable? If you have to rely upon Time Machine to recover those emails, surely this is a serious action? Did you get any help further on your query?

  • How to get all the custom tables created in database

    Hi,
    Is there any sql query present to fetch the name of all the custom tables(Not the tabless inbuilt tables which is given by oracle) present in any module like iExp,iRec or anything.
    Thanks

    It is difficult to differentiate custom tables from the seeded ones if there is no naming conventions followed during their creation. The custom schema or owner name can be used to differentiate them.
    Thanks,
    Neeraj

Maybe you are looking for

  • Making a header field as non editable while creating PO using ME21n

    Hi Friends, Could any one tell me the BADI or screen exit to make a header field (for eg: EKGRP - Purchasing Group) as non editable after giving default value to it? Thanks in advance, Ram

  • Session and Cache

    We have a stateless three-tier model. We found a client session is created for each query and the query is not cached. Is there a way to implement to use one client session for a few queries? Are the queries not cached because the cache is refreshed

  • Displaying Photo Titles for Photos Moved From iPhoto

    I have added comments in the 'titles' area of a number of photos. When I import the photos to iMovie, the photo titles are lost. Is there a way to maintain the photo titles, when photos are imported from iPhoto to iMovie. Thanks

  • AddListener property for ChoiceBox not working in MAC !!!

    The following piece of code is working fine in Windows but not in MAC. Any idea? cb.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<String>() { @Override public void changed(ObservableValue<? extends String> selected, String

  • Flash Player is small

    I have a Lenovo Yoga 2 Pro and am running Windows 8.1. My Flash Player is appearing normal size in Internet Explorer, but in Firefox and pop up windows it is extremely small.