Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / March 2006

Tip: Looking for answers? Try searching our database.

Query To Delete A certain # of records

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Cylvia - 20 Mar 2006 22:01 GMT
I have the following query to delete the top 65500 records from a table
tbl_CRS

DELETE * From tbl_CRS
SELECT TOP 65500
FROM tbl_CRS
ORDER BY Name;

, but it doesn't work. It give me syntax error in the FROM statement.  Can
anyone tell me why?

Thanks Much!!

Cyl
Cyl - 20 Mar 2006 23:03 GMT
I tried this but get a syntax error as well. in the select statement...

DELETE tbl_CRS *
SELECT TOP 65500
FROM tbl_CRS
ORDER BY Name;

>I have the following query to delete the top 65500 records from a table
>tbl_CRS
[quoted text clipped - 10 lines]
>
>Cyl
Ken Sheridan - 20 Mar 2006 23:46 GMT
Try using a subquery in the WHERE clause:

DELETE *
FROM tbl_CRS
WHERE Name IN
(SELECT TOP 65500 Name
FROM tbl_CRS
ORDER BY Name);

BTW I'd avoid using Name as a column name.  It could easily be confused with
the Name property of objects.  Use something like CustomerName, EmployeeName
or whatever is appropriate to avoid any ambiguity.

Ken Sheridan
Stafford, England

> I tried this but get a syntax error as well. in the select statement...
>
[quoted text clipped - 17 lines]
> >
> >Cyl
John Spencer - 21 Mar 2006 13:19 GMT
Also if you want to get exactly 65500 (or less)  records then I would
strongly suggest that you use your table's primary key in the order by and
as the field you are matching.

> Try using a subquery in the WHERE clause:
>
[quoted text clipped - 36 lines]
>> >
>> >Cyl
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.