一次性删除多个表中的所有记录 [英] Delete all records from multiple tables in one shot

查看:74
本文介绍了一次性删除多个表中的所有记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的,


有没有办法使用一个DELETE查询来调用几个表的所有记录?

Dear all,

Is there a way to dalete all records of several tables using one DELETE query?

推荐答案

我不相信。


如果你可以将表连接成一个可更新的查询,但是我认为只有其中一个表可以被清除。
I don''t believe so.

It may be possible if you can link the tables together into an updatable query, but even then I think only one of the tables can be cleared.


Neo是正确的。没有用于从多个表中删除记录的SQL命令。


也就是说,它仍然可以在Access中完成。有点klunky但仍然可行。


为要清除的每个表创建并保存一个删除查询。然后创建一个触发每个查询的宏。


所以当你想要清除所有表时,只需运行宏。


我一般不喜欢宏,但这对这个问题来说是最简单的解决方案。
Neo is correct. There is no SQL command for deleting records from more than one table.

That said, it can still be done in Access. Kinda klunky but still doable.

Create and save one delete query for each table you want to purge. Then create a macro that triggers each of the queries.

So when you want to purge all of your tables, just run the macro.

I generally don''t like macros but this would be the easiest solution for this problem.


如果单个查询不可能,那么我建议VBA循环可能会更容易。它不需要重复每个命令,因为可以在循环中处理各种表。
If a single query is not possible, then I would suggest a VBA loop would probably be easier. It need not repeat each command, as the various tables can be processed within the loop.


这篇关于一次性删除多个表中的所有记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆