473,770 Members | 6,348 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

empty option for delete records

hi, i read from some of the post that if i want to delete a whole
table using sql, i can use empty option to delete all the records but
keep the table definition, how to do that? the reason i want this
because i will get log full error for delete many records before
commit. instead of increase the log file size, i would like to know
other option like it mentioned above.
Nov 12 '05 #1
6 5556
There are two ways to do this in DB2. A fast way is IMPORT REPLACE with
a delimited file that contains no rows:

import from c:\ixf\rep.del of del replace into testvar

IMPORT is usually the best choice, because it does not lock the table
space. If the table has many active pages in the bufferpool, LOAD will
be faster, as IMPORT will flush the bufferpool. LOAD must be used if the
target table has Referential Integrity dependencies or summary tables
defined on it.
xixi wrote:
hi, i read from some of the post that if i want to delete a whole
table using sql, i can use empty option to delete all the records but
keep the table definition, how to do that? the reason i want this
because i will get log full error for delete many records before
commit. instead of increase the log file size, i would like to know
other option like it mentioned above.


Nov 12 '05 #2
There are two ways to do this in DB2. A fast way is IMPORT REPLACE with
a delimited file that contains no rows:

import from c:\ixf\rep.del of del replace into testvar

IMPORT is usually the best choice, because it does not lock the table
space. If the table has many active pages in the bufferpool, LOAD will
be faster, as IMPORT will flush the bufferpool. LOAD must be used if the
target table has Referential Integrity dependencies or summary tables
defined on it.
xixi wrote:
hi, i read from some of the post that if i want to delete a whole
table using sql, i can use empty option to delete all the records but
keep the table definition, how to do that? the reason i want this
because i will get log full error for delete many records before
commit. instead of increase the log file size, i would like to know
other option like it mentioned above.


Nov 12 '05 #3
Blair Adamache wrote:
There are two ways to do this in DB2. A fast way is IMPORT REPLACE with
a delimited file that contains no rows:

import from c:\ixf\rep.del of del replace into testvar

IMPORT is usually the best choice, because it does not lock the table
space. If the table has many active pages in the bufferpool, LOAD will
be faster, as IMPORT will flush the bufferpool. LOAD must be used if the
target table has Referential Integrity dependencies or summary tables
defined on it.


There is also an article that describes how to make the TRUNCATE operation
(via IMPORT ... REPLACE) available in SQL through a stored procedure:

http://www-106.ibm.com/developerwork...ein/index.html

--
Knut Stolze
Information Integration
IBM Germany / University of Jena
Nov 12 '05 #4
Blair Adamache wrote:
There are two ways to do this in DB2. A fast way is IMPORT REPLACE with
a delimited file that contains no rows:

import from c:\ixf\rep.del of del replace into testvar

IMPORT is usually the best choice, because it does not lock the table
space. If the table has many active pages in the bufferpool, LOAD will
be faster, as IMPORT will flush the bufferpool. LOAD must be used if the
target table has Referential Integrity dependencies or summary tables
defined on it.


There is also an article that describes how to make the TRUNCATE operation
(via IMPORT ... REPLACE) available in SQL through a stored procedure:

http://www-106.ibm.com/developerwork...ein/index.html

--
Knut Stolze
Information Integration
IBM Germany / University of Jena
Nov 12 '05 #5
Ian
xixi wrote:
hi, i read from some of the post that if i want to delete a whole
table using sql, i can use empty option to delete all the records but
keep the table definition, how to do that? the reason i want this
because i will get log full error for delete many records before
commit. instead of increase the log file size, i would like to know
other option like it mentioned above.


You can also :

alter table x not logged initially with empty table

If the table was created with the 'not logged initially' option.
Ian

-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Nov 12 '05 #6
Ian
xixi wrote:
hi, i read from some of the post that if i want to delete a whole
table using sql, i can use empty option to delete all the records but
keep the table definition, how to do that? the reason i want this
because i will get log full error for delete many records before
commit. instead of increase the log file size, i would like to know
other option like it mentioned above.


You can also :

alter table x not logged initially with empty table

If the table was created with the 'not logged initially' option.
Ian

-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Nov 12 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
5038
by: Wayno | last post by:
My php logs are coming up empty. I have done all I can think of, and all that made sense to me. Can someone take a look at my php.ini please and tell me what you think may be the problem. I double-checked the path to my error log. It is in /var/www/logs/php_error_log Thanks. :) -Wayne Stevenson
3
8899
by: tornado | last post by:
Hi all, I am pretty new to PHP. I was reading PHP manual and trying out the example from 2nd chapter (A simple Tutorial). When i try to print the variable as given in the example it returns a empty value instead of returning the browser type. Here is the line which i am using in my code and from manual: <?php echo $_SERVER; ?>
5
7106
by: Adrian Parker | last post by:
Hi. I have a date time picker in my program which uses ADO to read from an Access database. It works perfectly, unless the database is empty (no records) when opened. When you try to open an empty database, the date time picker returns error 545. Any attempts to progmatically add new records after the empty database has been opened returns, or to use the DTP and set a new date for those added records, "Field not updateable, Bound...
4
4712
by: Larry Rekow | last post by:
In Access I have a macro that, each night, takes a table with a primary key defined in it, and deletes all the rows. Then it imports/appends records from a fixed width text file. In this way, since the table is not deleted and recreated, the primary key is kept intact. What would be the equivalent SQL method for doing this in an automated way? I've tried letting DTS import the table from Access, but the primary key is lost. Is there...
0
431
by: xixi | last post by:
hi, i read from some of the post that if i want to delete a whole table using sql, i can use empty option to delete all the records but keep the table definition, how to do that? the reason i want this because i will get log full error for delete many records before commit. instead of increase the log file size, i would like to know other option like it mentioned above.
8
3165
by: J-P-W | last post by:
Hi, anyone got any thoughts on this problem? I have sales reps. that remotely send their data to an ftp server. The office downloads all files, the code creates an empty file, then downloads the data to it, then moves on to the next rep: ---------- conTARGETVisits = FTPLocation & "RepCallPlan" & Format(MyRepCode, "00")
8
2650
by: lmurgas | last post by:
FormA = List of organization records bound to table FormB = Tabbed form with details of organization and all other related entities, such as orders, contacts, invoices, (all as subforms bound to FormB on primary key) FormC = Pop-up to add/edit/delete a record from one of the associated entities. For example, there is a pop-up to add a new contact record to an Org. Current Behavior: 1. Open FormA and remains active 2. Double click on row...
2
2236
by: jimwest1995 | last post by:
Hello, I need to remove all the records from my DBF table another word i want to empty the table and this is what i did Delete * from MyTable this work but it does not remove the records from my table it flag them as delete.
6
4055
by: kstevens | last post by:
I have tables setup with a main table for information and a subtable that records the "multiple" records for the main record. I have written a query to go in and find Null or "" values to delete records that somebody started and closed out of, but then I realized that it wont delete the main records that information is recorded in if the sub record only contains 1 New record, because they arent neccesarily Null or "". Does anybody have any...
0
9591
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10225
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10053
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10001
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9867
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8880
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6676
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5449
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2816
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.