473,387 Members | 1,619 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Delete query

I was wondering if you can run a delete query in one database, and have the action take place in another database.

Namely, do something like

Delete (fields) IN (Database location) FROM (specify Table) WHERE (criteria is met)

Now, the reason i ask is a problem was set to me, and i really didn't have much say in the design aspect. but here goes

i have a main database where records and tables need to be deleted (archived) every 30 days. this is to keep the size small while keeping the most recent and neccessary data.

when the data is archived, it is sent to another database, archive. now, this data must be kept for 90 days, and by then, it is no longer of use, and should be deleted. i know this sounds stupid by moving and deleting all the time, but it's what is asked. if it can't be done, say so. please refrain from suggesting alternatives, just say it can't be done.

Here's the deal with the main db. when the program starts, a form loads that oes through the database, and deterines what tables are old enough to be deleted. By use of a make query and the IN clause, the table is then made and populated in the archive db. the program then goes and determines what records in the "main table" are to be deleted, then amends the "main table" in the archive db with the old records. after that is complete, all old tables are deleted from the main db and then all old records in the main table are deleted.

the database program continues and all is good.

so i ask you, is it possible to do the DELETE IN FROM WHERE method? or what?

thanks everyone
Sep 19 '06 #1
1 1910
how about this??

Expand|Select|Wrap|Line Numbers
  1. DELETE tblCoils.CoilID, tblCoils.Date, tblCoils.Customer, tblCoils.Alloy IN '\\DBserveer\\backup.mdb'
  2. FROM tblCoils
  3. WHERE (((tblCoils.Date)<(Date()-90)));
  4.  
the table names and field name are the same.
Sep 19 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Andrew DeFaria | last post by:
I created the following .sql file to demonstrate a problem I'm having. According to the manual: If |ON DELETE CASCADE| is specified, and a row in the parent table is deleted, then InnoDB...
2
by: Joe Del Medico | last post by:
I have two tables A & B and I want to delete all the records in A that are not in B. Can I do this in the query builder? It seems like a simple problem. I can easily find the records in A that...
5
by: ms | last post by:
Why does this select query return the correct records but when I make it a delete query I get a msgbox with "Could not delete from specified tables". SELECT BMIDLog.* FROM stageBMIDLog INNER...
2
by: Dave Burt | last post by:
Hi, Access officionados, I'm new here, so please cut me slack/gently tell me off if I'm out of line or in the wrong place. OK, here's something that seems silly (and is also problematic to...
8
by: John Baker | last post by:
Hi: Access 2000 W98! I have a table with numerous records in it, and am attempting to delete certain records that have been selected from it. These are selected based on the ID number in a...
13
by: forbes | last post by:
Hi, I have a user that used the Query Wizard to create a query in Access. Now she claims that her master table is missing all the data that was excluded from the query. Can you create anything...
3
by: Kevin M | last post by:
I have one table and have created a form from that table. Also, I have created a delete query. I want to but a button on the form which will delete all records from the table; however, I cannot get...
1
by: Matt | last post by:
I am writing a DELETE statement and I want to filter the records using another SELECT statement. My SELECT statement is a GROUP BY query that grabs all social security numbers from the "Data...
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...
3
by: Phil Stanton | last post by:
I have a form based on a complex query (Lots of tables) If I delete a record, everything appears to be OK. Get the message "Youa are about to delete 1 record ....". I say yes. The record count...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.