TRUNCATE TABLE和DELETE FROM区别
来源:互联网 发布:js 树形结构 复选框 编辑:程序博客网 时间:2024/05/16 08:24
TRUNCATE TABLE和DELETE FROM区别
TRUNCATE TABLE 和不带 WHERE 的 DELETE 功能是一样的,都是删除表中的所有数据,不过 TRUNCATE TABLE 速度更快,占用的日志更少,这是因为 TRUNCATE TABLE 直接释放数据页并且在事务日志中也只记录数据页的释放,而 DELETE 是一行一行地删除,在事务日志中要记录每一条记录的删除。那么可不可以用 TRUNCATE TABLE 代替不带 WHERE 的 DELETE 呢?在以下情况是不行的:
1、要保留标识的情况下不能用 TRUNCATE TABLE,因为 TRUNCATE TABLE 会重置标识。
2、需要使用触发器的情况下不能使用 TRUNCATE TABLE ,它不会激发触发器。
3、对于由 FOREIGN KEY 约束引用的表(即主键所在的表,不是外键所在的表)不能使用 TRUNCATE TABLE。
4、对于参与了索引视图的表不能使用 TRUNCATE TABLE ,注意指索引视图,并非普通视图。
- TRUNCATE TABLE和DELETE FROM区别
- TRUNCATE TABLE和DELETE FROM区别
- delete from和truncate table的区别
- TRUNCATE TABLE和DELETE FROM区别
- delete from和truncate table的区别
- delete from和truncate table的区别
- delete from和truncate table的区别
- delete from table和truncate table的区别
- delete from table & truncate table 的区别
- delete table 与delete from table truncate table 的区别
- DELETE 和TRUNCATE TABLE区别
- Truncate table,Delete From table,与Drop table的区别
- delete from tablea & truncate table tablea & drop table 的区别
- SQL数据库 "TRUNCATE TABLE" "DELETE FROM TABLE" 的区别
- Truncate/Delete table区别
- SQL TRUNCATE TABLE和DELETE的区别
- oracle delete from和 truncate区别
- Truncate Table 与DELETE FROM
- C#通过拖动窗体移动窗口
- 小型数据库的选择
- RemObjects
- 关于Mysql + asp.net注射能支持多语句的感慨
- MySQL 基本操作命令
- TRUNCATE TABLE和DELETE FROM区别
- UML Distilled 3rd
- 用MS SOAP SDK 时编译错误
- BMP格式结构详解(转http://blog.chinaunix.net/u3/94039/showart_1885416.html)
- android NDK开发相关
- 关于过去,关于Java的点滴
- 编译android2.2
- 网站时的开发规范
- 随笔