473,473 Members | 1,985 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Is there a way to delete every record in a table without selecting all the rows

Hi,

I have a table with 1 million rows that I need to delete.

Is there a way to delete them quickly considering I get errors if I
try to select them all and then hit delete?

What I'm looking for is some sort of "delete all records" menu option.

Thanks
Nov 13 '05 #1
5 1607
Don't try to do this from datasheet view.

Create a Delete Query in the Query Builder and execute it: Add the Table to
the Query, drag down the * into the grid, then on the menu, click Query and
choose Delete. Execute it with the ! icon on the toolbar. Don't be
impatient, as with a million rows, it will take some time.

Larry Linson
Microsoft Access MVP
<ja***@cd-worx.com> wrote in message
news:40**************@news.clari.net.au...
Hi,

I have a table with 1 million rows that I need to delete.

Is there a way to delete them quickly considering I get errors if I
try to select them all and then hit delete?

What I'm looking for is some sort of "delete all records" menu option.

Thanks

Nov 13 '05 #2
Thanks a lot. Will give it a go.
On Tue, 29 Jun 2004 01:14:40 GMT, "Larry Linson"
<bo*****@localhost.not> wrote:
Don't try to do this from datasheet view.

Create a Delete Query in the Query Builder and execute it: Add the Table to
the Query, drag down the * into the grid, then on the menu, click Query and
choose Delete. Execute it with the ! icon on the toolbar. Don't be
impatient, as with a million rows, it will take some time.

Larry Linson
Microsoft Access MVP
<ja***@cd-worx.com> wrote in message
news:40**************@news.clari.net.au...
Hi,

I have a table with 1 million rows that I need to delete.

Is there a way to delete them quickly considering I get errors if I
try to select them all and then hit delete?

What I'm looking for is some sort of "delete all records" menu option.

Thanks



Nov 13 '05 #3

Set up a select query which selects the whole table (i.e with no criteria) and then change
it to a delete query! Then run it!

Best

John Baker
ja***@cd-worx.com (ja***@cd-worx.com) wrote:
Hi,

I have a table with 1 million rows that I need to delete.

Is there a way to delete them quickly considering I get errors if I
try to select them all and then hit delete?

What I'm looking for is some sort of "delete all records" menu option.

Thanks


Nov 13 '05 #4
On Mon, 04 Oct 2004 11:33:55 GMT, John Baker <Ba******@Verizon.net>
wrote:

Set up a select query which selects the whole table (i.e with no criteria) and then change
it to a delete query! Then run it!

Best

John Baker
ja***@cd-worx.com (ja***@cd-worx.com) wrote:
Hi,

I have a table with 1 million rows that I need to delete.

Is there a way to delete them quickly considering I get errors if I
try to select them all and then hit delete?

What I'm looking for is some sort of "delete all records" menu option.

Thanks

Hi
It can take a long time to delete a million rows. If at all possible I
would delete (kill, drop) the table and replace it from an empty copy.
However this will not be easy if there are external relationships.
David
Nov 13 '05 #5
John,
The SQL for it will look something like this: "DELETE TABLE_1.* FROM
TABLE_1;". That gets rid of every row in the table. It will fail (as
others here have said) if the errors you are getting are due to constraints
in place on the table. If you wanted a script that really would dump a
million rows without complaining about constraint violations you would have
to include a number of "ALTER TABLE_2 DROP CONSTRAINT . . . " sorts of
statements to get rid of the constraints first, then delete your rows.

"John Baker" <Ba******@Verizon.net> wrote in message
news:b7********************************@4ax.com...

Set up a select query which selects the whole table (i.e with no criteria)
and then change
it to a delete query! Then run it!

Best

John Baker
ja***@cd-worx.com (ja***@cd-worx.com) wrote:
Hi,

I have a table with 1 million rows that I need to delete.

Is there a way to delete them quickly considering I get errors if I
try to select them all and then hit delete?

What I'm looking for is some sort of "delete all records" menu option.

Thanks

Nov 13 '05 #6

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

Similar topics

7
by: Philip Mette | last post by:
I have been searching many postings and I cant seem to find anyone that has this answer so I decided to post. I am using SQL (Transact-SQL).If I have 2 tables with columns...
16
by: robert | last post by:
been ruminating on the question (mostly in a 390/v7 context) of whether, and if so when, a row update becomes an insert/delete. i assume that there is a threshold on the number of columns of the...
5
by: jeff | last post by:
i am using ms access as my database i can successfully delete a single record from a table using : targetRow.Delete() Try reportDataAdapter.Update(reportDataSet, "table1" )...
6
by: polocar | last post by:
Hi, I'm writing a program in Visual C# 2005 Professional Edition. This program connects to a SQL Server 2005 database called "Generations" (in which there is only one table, called...
1
by: vbDavidC | last post by:
I am adding a new record to a table via a dataset/adapter. I have got the following to work for me but I am wondering if there is a better way to do this. I am having to have something in my...
5
by: Bob Bridges | last post by:
Start with two tables, parent records in one and child records in the other, a one-to-many relationship. Create a select statement joining the two. Display the query in datasheet mode. When I...
8
by: prosad | last post by:
Hi! Have been hitting my head on the wall for two weeks now. am a php newbie. have a form that on submitting to a MySQL DB instantly generates a HTML table on the same page. what i need now is way...
2
by: Radu | last post by:
Hi. I have a "union" table which results of a union of two tables. Occasionally I could have duplicates, when the same PIN has been added to both tables, albeit at different Datees/Times, such...
1
by: Bob | last post by:
Hello, Using VB 2005.net. I have a bound datagridview and a delete button control (or when the user pressed the 'Delete' key) I can successfully delete the selected record from the table and...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
1
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...
0
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
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...

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.