Deleting all records in a table at once

Hi,
having problems with this, using TAdoTable in D7 for deleting all records in a table in a mdb-file.
I worked around it bij looping through all records and deleting one by one, but this is rather slow.

Thanx
0
Christof
11/5/2008 8:35:10 PM
embarcadero.delphi.ado 597 articles. 1 followers. Follow

5 Replies
1690 Views

Similar Articles

[PageSpeed] 49

Christof Lambrecht wrote:

> Hi,
> having problems with this, using TAdoTable in D7 for deleting all
> records in a table in a mdb-file.  I worked around it bij looping
> through all records and deleting one by one, but this is rather slow.
> 
> Thanx

Can't you use a TADOCommand and run a 'DELETE FROM abcd' statement? It
is the fastest way to delete records from a client application.


Regards
0
Alexandre
11/5/2008 8:40:30 PM
Will trry it, I was looking at
procedure DeleteRecords(AffectRecords: TAffectRecords = arAll);
without succes so far,

> {quote:title=Alexandre Machado wrote:}{quote}
> Christof Lambrecht wrote:
> 
> > Hi,
> > having problems with this, using TAdoTable in D7 for deleting all
> > records in a table in a mdb-file.  I worked around it bij looping
> > through all records and deleting one by one, but this is rather slow.
> > 
> > Thanx
> 
> Can't you use a TADOCommand and run a 'DELETE FROM abcd' statement? It
> is the fastest way to delete records from a client application.
> 
> 
> Regards
0
Christof
11/5/2008 10:18:02 PM
DeleteRecords should work, but it requires a lot more effort!

Christof Lambrecht wrote:
> Will trry it, I was looking at
> procedure DeleteRecords(AffectRecords: TAffectRecords = arAll);
> without succes so far,
> 
>> {quote:title=Alexandre Machado wrote:}{quote}
>> Christof Lambrecht wrote:
>>
>>> Hi,
>>> having problems with this, using TAdoTable in D7 for deleting all
>>> records in a table in a mdb-file.  I worked around it bij looping
>>> through all records and deleting one by one, but this is rather slow.
>>>
>>> Thanx
>> Can't you use a TADOCommand and run a 'DELETE FROM abcd' statement? It
>> is the fastest way to delete records from a client application.
>>
>>
>> Regards
0
quinn
11/5/2008 11:32:32 PM
The arALL for deleteRecords has never worked.
It seems to be an ADO documnetation issue and not a Delphi implementation issue.
A Delete query is the proper way to delete records




> {quote:title=quinn wildman wrote:}{quote}
> DeleteRecords should work, but it requires a lot more effort!
> 
> Christof Lambrecht wrote:
> > Will trry it, I was looking at
> > procedure DeleteRecords(AffectRecords: TAffectRecords = arAll);
> > without succes so far,
> > 
> >> {quote:title=Alexandre Machado wrote:}{quote}
> >> Christof Lambrecht wrote:
> >>
> >>> Hi,
> >>> having problems with this, using TAdoTable in D7 for deleting all
> >>> records in a table in a mdb-file.  I worked around it bij looping
> >>> through all records and deleting one by one, but this is rather slow.
> >>>
> >>> Thanx
> >> Can't you use a TADOCommand and run a 'DELETE FROM abcd' statement? It
> >> is the fastest way to delete records from a client application.
> >>
> >>
> >> Regards
0
Brian
11/6/2008 1:21:24 AM
Alexandre Machado wrote:

> Can't you use a TADOCommand and run a 'DELETE FROM abcd' statement? It
> is the fastest way to delete records from a client application.

In many SQL backends TRUNCATE is faster since it's made for clearing
tables, but it might have some qualifications or side effects.  e.g.
The table can't be referenced by a foreign key, has more strict
permissions than DELETE by default, etc.

If those things are acceptable, then TRUNCATE might be the way to go.

-- 
Pax,

Anthony Frazier
Victor Printing, Inc.
0
Anthony
11/7/2008 3:14:10 PM
Reply:

Similar Artilces:

Having problem copy all records from 1 table to another with same structure and Delete All Records In one table in ASP.NET C# codes
Having problem copy all records from 1 table to another with same structure and Delete All Records In one table in ASP.NET C# codes hi all, what i do is i save records into 3 temporary table which is Temp1F ,Temp2F, and Temp3F, after i press confirm button, all records of temp1f,2f and 3f will be copy into 1F,2F and 3F table, and after copied, all records in the Temp table will be deleted.is that possible?pls advise...thanks alot !!! And 1 more information, i use Microsoft access database, the tables are in the same database .... string q1 = "Insert into 1F Select * From...

Deleting records and selecting the records after the delete
iam trying to delete a record from the database using ADO.NET which works fine. After i delete a record i want to refresh the page by selecting the remaining records in the database. What shud be done to achieve this? i have tried creating a new data adapter and filling the dataset by using the selectcommand but i am still able to see the deleted record. what am i doing wrong? Thanks If you are using SQL Server these steps can be performed using a stored procedure. How to use a stored procedure and why cant i make it work by using individual queries? what does the stored procedure ...

Delete records in a table
I have two tables. TableA: p1 p2 p3 a4 a5 ----------------------------- 11 aa bb sdf erwer 22 ww xx 989 oiuu 33 ee qq lk8 9jio ..... TableB: p1 p2 p3 ------------------ 11 aa bb 33 ee qq ..... I want to delete those records in TableA which the value of their first three fields can be found in TableB. I try the sql : delete from TableA which (p1,p2,p3) in (select p1,p2,p3 from TableB) , but seems Sybase only allow one field for the "in" function. If I use M...

Deleting the records from a table
------=_NextPart_000_0071_01C4E1FE.7F8916D0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Hi Friends, I need a help from you in implementation of purging functionality. I am given a hash of table(s), each having millions of records. i need to delete those records keeping latest 5 days records in the tables. I know the delete query like: delete from $tableName where adddtm < today ? $numDays ; where $numDays is the variable having number of days latest data to be retained. if i give the direct query like above it takes a lot of time...

ADO delete record
I'm struggling with the following, any help would be appreciated. ADO table = ADOTbl1 ADOTbl1 fields = [FN, LN, Active] > [string, string, boolean] ADO query = Query1 dbgrid multiselect = true, with 3 records selected for deletion. Rec1 & Rec2 are duplicates which produces OLE errors w/o using sql cmds Rec1 selected: FN='A', LN='B', True Rec2 selected: FN='A', LN='B', True Rec3 selected: FN='C', LN='B', True Var SQLdel: Integer; .......... For i := 0 to dbGrid.SelCount-1 Do Begin ADOTbl1.Bookmark := dbGrid.SelectedRow...

deleting records from tables
hi everybody,                    in Access, i am having two tables. both r having the id column as primary key. in one table there are more than 200 records r there. in other tables 50 records are there. now i want 2 delete the records from first table where the id of first table is equal to id of second tablecan anyone help me  regardsvivek Use such statement:DELETE *FROM         Table1WHERE     ID IN     &...

how to order records from one table by records of another table?
i have two tables: subject ~~~~~~~ name number (primary key document ~~~~~~~~ name, number (primary key) subject_number (foreign key) what SQL query will return a table (view) of the subjects, ordered by the number of documents each subject has? subjects with no documents should not be included. Hello, Following is a query: SELECT subject.name, Document.name FROM subject INNER JOIN Document1 ON subject.number = Document.subject_number ORDER BY Document.name Dear, this is not a SQL centric blog. So its may not possible every time to solve SQL relat...

On Record Inserted in table a, Insert record in table b
 Hi Guys, I have heard that is is possible to write a script (stored procedure) that my MS SQL Server creates a record in table b for every record in table a.e.g.I insert "CustomerNr"  [pk] and "CustomerName" in table a and I want that this "CustomerNr" is now used to create a row in table b (where there are only update queries and no insert queries).is that possible?many thankspolynaux  You can use a trigger in the tablea insert command to insert a new row in  the tablebVikram www.vikramlakhotia.comPlease mark the answer if it helped ...

Deleting the master table withour deleting the child tables
Hi i have to delete the master table data without deleting the child table records,is there any solution for this,  parent table has relation with the child table. regards vinod.t.vSoftware EngineerUshustechTechnoparkTrivandrum India You need to temporarily disable constraints on the table. Disable constraints: ALTER TABLE MyTable NOCHECK CONSTRAINT ALL Enable constraints: ALTER TABLE MyTable CHECK CONSTRAINT ALL    If this post was useful to you, please mark it as answer. Thank you! Thanks johram i can try this solution, this is usefullSoftware Enginee...

deleting records in one table which is depend on another table in grid view by using asp.net(sql database)
Hi, Pls help me.I am able to do display,edit,and sort the data in the grid view. but not able to do delete operation in the grid view. actually i have two tables category1 and products. both are dependent.in products table i can delete but when i am going to deleting record in category.....error coming as.... The DELETE statement conflicted with the REFERENCE constraint "fk". The conflict occurred in database "selfdb", table "dbo.product1", column 'productid'.The statement has been terminated. i wrote the delete command as delete dbo.category1 ...

Help with How to loop record in Parent Table, find matching records in Child Table, then send E-Mail matching records.
Folks,Using NorthWind as Example: Parent Table derived from: Categories. I added a new Column E-Mail and Selecting rows where Category Id <=3. Here is my Data. Category ID Category Name Category E-mail 1 Beverages Beverages.com 2 Condiments Condiments.com 3 Confections  Child Table derived from: Products. I am Selecting rows where Category Id <=3. Here is my Sample Data. Category ID Product Name Quantity Per Unit 1 Chang 24 - 12 oz bottles 1 Côte de Blaye 12 - 75 cl bottles 1 Ipoh Coffee 16 - 500 g tins 1 Outback Lager 24 ...

Delete Multple Table records
 Hi : I have the following tables 1 Product_Tbl_Catagory (CategoryID,CategoryName), 2 Product_Tbl_SubCatagory(CategoryID,SubCategoryID,SubCategoryName) 3 Product_Tbl_ProductDetails(ProductID,ProductName,CategoryID,CategoryName,SubCategoryID,SubCategoryName,Images I need to delete records from these tables based on categoryID .Can any one send me the query The basic query for one table would be like this:  delete product_tbl_catagory where categoryID = 'somevalue'  Other tables would be similar. Anything more specific would require us to know wh...

I want to delete a record from a table
Hi friends,   I am trying to delete a record from the an order table when i click a button. I am using the following code:Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.ClickDim cmd As New OleDbCommand("DELETE FROM Orders WHERE Order_ID = '" & TextBox1.Text & "'", New OleDbConnection(strConn)) cmd.Connection.Open() cmd.ExecuteNonQuery() cmd.Connection.Close() End Sub   I have a problem with the execute command, can anyone help? can you post the error message?  At the moment, you...

how to delete Record from from Checkboxgridview when i check the checkbox i wana delete that record but how??????
Hello All,I m new user to c# .Net 2.0i want to implement a gridview that displays all records in database(sql server 2005) & which containd checkbox field..Now i want that whenever this form is displayed then user can be able check the checkbox for each record. & when delete button is pressed then all the checked records should not be deleted.. so plz help me how to delete that record?????? Thanx in advance.. bharat_asp83: Hello All,I m new user to c# .Net 2.0i want to implement a gridview that displays all records in database(sql server 2005) & which containd checkb...

Web resources about - Deleting all records in a table at once - embarcadero.delphi.ado

Deleting Online Predators Act of 2006 - Wikipedia, the free encyclopedia
( DOPA ) is a bill ( H.R. 5319 ) brought before the United States House of Representatives on May 9, 2006 by Republican Pennsylvania Representative ...

Are You Deleting Facebook Messages Or Unknowingly Saving Them?
You might find yourself, on occasion, the recipient or sender of hostile or just plain weird Facebook messages . And you likely delete these ...

Deleting your Facebook page is foolish
... brag, trailing closely behind that fantastically annoying “I don’t even have a TV , never mind watch the drivel!” Let’s lay it out: deleting ...

AdWords Campaign Experiments: Applying or deleting your experimental changes - YouTube
To improve your AdWords experience, we're testing a new tool that helps you optimize your account. AdWords Campaign Experiments, or ACE, does ...

Deleting abusive online content a 'near impossible' task
POSTING offensive, harassing, intimidating or defamatory content online takes mere seconds, but getting it removed can take what feels like a ...

Paleo advocate Pete Evans accused of deleting critical posts on Facebook
Is Paleo Pete Evans is open to dietary debate? Some say he's not.

Microsoft on the threshold of deleting 'appalling' Windows 8 software
MICROSOFT plans to cut its losses on Windows 8, the latest version of the software that runs the majority of the world's computers, jettisoning ...

How to get iOS 8 without deleting everything on your phone
If you've tried downloading iOS 8, or know anyone who has already done so, you're probably familiar with the biggest complaint: The download ...

Deleting gun data breaks law, info czar says
Information Commissioner Suzanne Legault told a Commons committee Tuesday that a federal bill to destroy all the records in the long-gun registry ...

Jason Kenney under fire for praising ‘perfect, unaccented English’, deleting tweet
Canada's Minister for Multiculturalism, Jason Kenney, caused an upset Monday after praising an 11-year-old Iraqi refugee who "already speaks ...

Resources last updated: 12/22/2015 6:42:10 AM