DROP TABLE vs DoCmd.DeleteObject acTable [英] DROP TABLE vs DoCmd.DeleteObject acTable

查看:64
本文介绍了DROP TABLE vs DoCmd.DeleteObject acTable的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的客户端有一个使用临时表的数据库。在

更新过程中,我有代码如果fTableExists(tempTblName)= True

那么DoCmd.DeleteObject acTable,tempTblName


然后我想到使用:如果fTableExists(tempTblName)= True那么

CurrentDb.Execute" DROP TABLE" &安培; tempTblName


两者都有优势吗?真正酷的是DROP TABLE

删除了表格,我没有那么多压缩数据库。


My client has a db I am working that uses temp tables. During an
update procedure, I had the code If fTableExists(tempTblName) = True
Then DoCmd.DeleteObject acTable, tempTblName

Then I thought of using: If fTableExists(tempTblName) = True Then
CurrentDb.Execute "DROP TABLE " & tempTblName

Is there an advantage to either? What really be cool is DROP TABLE
deleted the table and I didn''t have to compact the db so much.


推荐答案

甚至更酷的是使用临时数据库,将表链接到数据中

db。这样你就不会在数据db中添加或删除表对象 - 而是

你只需要根据需要用新副本覆盖临时数据库。


hth

" Dean" < no ***** @ coveyaccounting.comwrote in message

news:00 ************************* ********* @ l64g2000 hse.googlegroups.com ...
even cooler would be to use a temp db, with the tables linked into the data
db. that way you never add or delete table objects in the data db - instead
you just overwrite the temp db with a fresh copy as needed.

hth
"Dean" <no*****@coveyaccounting.comwrote in message
news:00**********************************@l64g2000 hse.googlegroups.com...

我的客户端有一个使用临时表的数据库。在

更新过程中,我有代码如果fTableExists(tempTblName)= True

那么DoCmd.DeleteObject acTable,tempTblName


然后我想到使用:如果fTableExists(tempTblName)= True那么

CurrentDb.Execute" DROP TABLE" &安培; tempTblName


两者都有优势吗?真正酷的是DROP TABLE

删除了表格,我没有那么多压缩数据库。

My client has a db I am working that uses temp tables. During an
update procedure, I had the code If fTableExists(tempTblName) = True
Then DoCmd.DeleteObject acTable, tempTblName

Then I thought of using: If fTableExists(tempTblName) = True Then
CurrentDb.Execute "DROP TABLE " & tempTblName

Is there an advantage to either? What really be cool is DROP TABLE
deleted the table and I didn''t have to compact the db so much.



8月21日,6:05 * am,Dean< nore ... @ coveyaccounting.comwrote:
On Aug 21, 6:05*am, Dean <nore...@coveyaccounting.comwrote:

我的客户有我工作的数据库使用临时表。 *在

更新程序期间,我有代码如果fTableExists(tempTblName)= True

那么DoCmd.DeleteObject acTable,tempTblName


然后我想到使用:如果fTableExists(tempTblName)= True那么

CurrentDb.Execute" DROP TABLE" &安培; tempTblName


两者都有优势吗? *真正很酷的是DROP TABLE

删除了表格,我没有必要如此压缩数据库。
My client has a db I am working that uses temp tables. *During an
update procedure, I had the code If fTableExists(tempTblName) = True
Then DoCmd.DeleteObject acTable, tempTblName

Then I thought of using: If fTableExists(tempTblName) = True Then
CurrentDb.Execute "DROP TABLE " & tempTblName

Is there an advantage to either? *What really be cool is DROP TABLE
deleted the table and I didn''t have to compact the db so much.



我确实资助了以下帮助:

"当你使用SQL DROP语句或<时,删除表更快br />
没有谓词的SQL DELETE语句。


I did fund the followsin the the help:
"Deleting a table is faster when you use the SQL DROP statement or the
SQL DELETE statement without a predicate."


是的。如果是阴天,SQL DROP语句可以将表格丢弃在
1.6中,比DoCmd快几百分之一秒(16/10000秒)

DELETE。试想一下,在一万次删除之后我们可以节省16

秒!好吧,只有大约1/4的时间,它的速度要快得多,所以我估计在10000次删除时会节省4秒。哇哦!

无法访问帮助盛大!不仅如此,当我们阅读

访问帮助时,我们可以确信有50%的可能性它是b
正确(还有25%)这是完整的机会!如果你把它与Stevie Harper的演讲相提并论,那就太好了

很好!


但是我还在努力理解为什么你认为DROP Table (因为

与DoCmd.Delete相对)可能会减少压缩的需要。我想

我会用我的四秒钟来思考这个问题。


顺便说一句,在我九十年代初使用Access时我不记得了永远

使用保存到磁盘的临时表。我喜欢这样。


8月21日,5:37 * pm,Dean< nore ... @ coveyaccounting.comwrote:
Yes. If it''s a cloudy day the SQL DROP statement can trash a table in
1.6 one thousandths of a second (16/10000 seconds) faster than DoCmd
DELETE. Just think, after ten thousand deletions we could save 16
seconds! Well it''s measurably faster only about 1/4 of the time, so I
guess that would be four seconds saved in 10000 deletions. WooHoo!
Ain''t Access Help grand! Not only that but when we read something in
Access Help we can feel confident that there is a 50% chance that it''s
correct (and a further 25% chance that it''s complete)! That''s pretty
good if you compare it with a Stevie Harper speech!

But I''m still trying to understand why you think DROP Table (as
opposed to DoCmd.Delete) might reduce the need to compact. I guess
I''ll use my four seconds to think about that.

BTW, in my use of Access since the early nineties I do not recall ever
using a temporary table that was saved to disk. I like it that way.

On Aug 21, 5:37*pm, Dean <nore...@coveyaccounting.comwrote:

我确实资助了以下帮助:

当您使用SQL DROP语句或

SQL DELETE语句时,删除表更快没有谓词。
I did fund the followsin the the help:
"Deleting a table is faster when you use the SQL DROP statement or the
SQL DELETE statement without a predicate."


这篇关于DROP TABLE vs DoCmd.DeleteObject acTable的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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