与截断语句的标准定义混淆
Confused with Standard definition of Truncate statement
我有相当多的 MS 经验SQL server.We 将数据库从 MYSQL 迁移到 SQL server.I 从未使用过 MYSQL,所以我正在使用这个 link.
来解决差异
在页面的一个地方,下面是Truncate的定义..
The SQL standard defines the TRUNCATE TABLE tablename statement (optional feature ID F200, new in SQL:2008) as:
Delete all rows of a base table without causing any triggered action.
Unfortunately, the standard doesn't specify
1. whether TRUNCATE TABLE should be allowed in a transaction involving other statements, or not
2. whether TRUNCATE TABLE should imply an immediate COMMIT, or not
对于SQL服务器,页面显示
Follows the standard.
In MSSQL, TRUNCATE TABLE is allowed in a transaction involving other operations, and TRUNCATE TABLE does not imply an immediate COMMIT operation.
对于MYSQL,页面显示
MySQL has a TRUNCATE TABLE statement, but it doesn't always follow the standard.
Note that in some cases, MySQL's truncate command is really the equivalent of an unrestricted DELETE command (i.e.: potentially slow and trigger-invoking). Its behaviour depends on which storage engine the table is managed by.
When using InnoDB (transaction safe) tables, TRUNCATE TABLE is allowed in a transaction involving other operations, however TRUNCATE TABLE implies an immediate COMMIT operation.
在SQL服务器中,当您截断 table
1.The 操作可能被最少记录
2.only 页面释放发生并记录在事务日志中
所以我的问题是:
1.What 以标准方式执行以下措辞,以及 SQL 服务器如何遵循标准而 MYSQL 不是。
whether TRUNCATE TABLE should imply an immediate COMMIT, or not
感谢来自 Clifton_h 的链接和对此的回答 question...
我的问题是这个措辞是什么意思
whether TRUNCATE TABLE should imply an immediate COMMIT, or not
这一切都归结为您是否可以回滚截断..
对于 MYSQL 和 Oracle:
你不能回滚截断,因为那些 DBMS 确实在事务后应用隐式提交,只有在出错的情况下才会回滚,但用户不能这样做
对于 SQL 服务器:
您可以回滚截断,因为不应用立即提交..
我有相当多的 MS 经验SQL server.We 将数据库从 MYSQL 迁移到 SQL server.I 从未使用过 MYSQL,所以我正在使用这个 link.
来解决差异在页面的一个地方,下面是Truncate的定义..
The SQL standard defines the TRUNCATE TABLE tablename statement (optional feature ID F200, new in SQL:2008) as: Delete all rows of a base table without causing any triggered action.
Unfortunately, the standard doesn't specify
1. whether TRUNCATE TABLE should be allowed in a transaction involving other statements, or not
2. whether TRUNCATE TABLE should imply an immediate COMMIT, or not
对于SQL服务器,页面显示
Follows the standard.
In MSSQL, TRUNCATE TABLE is allowed in a transaction involving other operations, and TRUNCATE TABLE does not imply an immediate COMMIT operation.
对于MYSQL,页面显示
MySQL has a TRUNCATE TABLE statement, but it doesn't always follow the standard.
Note that in some cases, MySQL's truncate command is really the equivalent of an unrestricted DELETE command (i.e.: potentially slow and trigger-invoking). Its behaviour depends on which storage engine the table is managed by.
When using InnoDB (transaction safe) tables, TRUNCATE TABLE is allowed in a transaction involving other operations, however TRUNCATE TABLE implies an immediate COMMIT operation.
在SQL服务器中,当您截断 table
1.The 操作可能被最少记录
2.only 页面释放发生并记录在事务日志中
所以我的问题是:
1.What 以标准方式执行以下措辞,以及 SQL 服务器如何遵循标准而 MYSQL 不是。
whether TRUNCATE TABLE should imply an immediate COMMIT, or not
感谢来自 Clifton_h 的链接和对此的回答 question...
我的问题是这个措辞是什么意思
whether TRUNCATE TABLE should imply an immediate COMMIT, or not
这一切都归结为您是否可以回滚截断..
对于 MYSQL 和 Oracle:
你不能回滚截断,因为那些 DBMS 确实在事务后应用隐式提交,只有在出错的情况下才会回滚,但用户不能这样做
对于 SQL 服务器:
您可以回滚截断,因为不应用立即提交..