gpt4 book ai didi

sql-server - sql update先删除再插入吗?

转载 作者:搜寻专家 更新时间:2023-10-30 20:09:14 24 4
gpt4 key购买 nike

Sql server究竟是如何进行更新操作的?它会进行就地更新吗?或者它对受影响的每一行进行删除然后插入?我知道更新操作类似于删除然后插入,因为旧值存储在删除的中,新值存储在插入的...

有人告诉我更新操作是通过删除然后插入来完成的,但我不确定为什么要这样实现。请赐教。

最佳答案

MSDN Update section :

The Database Engine converts a partial update to a full update when the UPDATE statement causes either of these actions:

  • Changes a key column of the partitioned view or table.

  • Modifies more than one row and also updates the key of a nonunique clustered index to a nonconstant value.

partial update

Partial-update transaction directly writes a character string at a user-defined position of a table column without issuing a delete and replace command, as would happen in a full update.

Partial update does not support multibyte character set conversion. Partial update support is restricted to Microsoft SQL Server.

我进行了一些搜索,看来您问题的答案取决于您要更新的内容。

希望这对您有所帮助。

关于sql-server - sql update先删除再插入吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29784420/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com