在sql中删除和截断之间的差异?删除的文件或表格去哪里? [英] Diff between delete and truncate in sql ? where deleted files or tables goes?
本文介绍了在sql中删除和截断之间的差异?删除的文件或表格去哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
任何1可以告诉我什么是
sql.on中删除和截断之间的差异哪种情况,
我们将选择其中一个选项。
假如我们删除一个表,它在哪里?
假设我们截断一个表,哪里有它去了吗?
提前感谢
Naveen ...
解决方案
从数据库中删除表:
drop table [table]
从表中删除数据:
从[table]中删除
或
truncate table [table]
你drop
一个表
它和它的记录一起消失了。
当从
时,内容会消失,但不会是表
中删除表
。
同样的截断
除了你不能截断
一个表
哪里有外键 - 你应该使用delete
。您应该注意一些其他差异和问题 - 我会留给您进行研究。
参见这里 [ ^ ]。
Hi all,
Can any 1 tel me what is
Diff between delete and truncate in sql.on which scenario,
we will choose either options.
Suppose if we delete a table ,where does it goes ?
Suppose if we truncate a table ,where does it goes ?
thanks in advance
Naveen...
解决方案
To delete a table from the database:
drop table [table]
To remove data from a table:
delete from [table]
or
truncate table [table]
When youdrop
atable
it, along with it''s records, is gone.
When youdelete
from atable
the content goes but not thetable
.
Same fortruncate
other than you can''ttruncate
atable
where there are foreign keys - you should usedelete
. There are some other differences and issues you should be aware of - I''ll leave that to you to do the research.
See here[^].
这篇关于在sql中删除和截断之间的差异?删除的文件或表格去哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文