SQL Server:复制表中的列

发布于 2024-07-06 13:03:10 字数 38 浏览 7 评论 0原文

将表中的列中的所有值复制到同一表中的另一列的最简单方法是什么?

What is the easiest way to copy the all the values from a column in a table to another column in the same table?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

无声静候 2024-07-13 13:03:10

使用单个语句(如果列具有相同的数据类型)

UPDATE <tablename>
SET <destination column name> = <source column name>

With a single statement (if the columns have the same datatype)

UPDATE <tablename>
SET <destination column name> = <source column name>
桃气十足 2024-07-13 13:03:10

此脚本将使用相应行中 field2 的值更新 field1 中的所有值

UPDATE table SET field1 = field2

This script will update ALL values in the field1 with the values from the field2 in the corresponding row

UPDATE table SET field1 = field2
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文