I'm trying to achieve a simple task, I create a new column in a table and immediately afterwards try to copy a value of some other column in the same table into the new created column but I got a
我正在尝试实现一个简单的任务,我在表中创建一个新列,然后立即尝试将同一个表中其他一些列的值复制到新创建的列中但是我得到了一个
Invalid column name 'COMMENT_TMP'. error
列名称“COMMENT_TMP”无效。错误
The SQL is
SQL是
Invalid column name 'COMMENT_TMP'.
列名称“COMMENT_TMP”无效。
ALTER TABLE TASK_COMMENT ADD COMMENT_TMP text;
UPDATE TASK_COMMENT SET TASK_COMMENT.COMMENT_TMP = COMMENT;
2 个解决方案
#1
6
You first need to send theALTER
batch to the server before executing the UPDATE
. Add GO
after the ALTER
statement
首先需要在执行UPDATE之前将ALTER批处理发送到服务器。在ALTER语句后添加GO
#2
9
Add the batch delimiter and the table name in your update statement.
在update语句中添加批处理分隔符和表名。
ALTER TABLE TASK_COMMENT ADD COMMENT_TMP text;
GO
UPDATE TASK_COMMENT SET COMMENT_TMP = COMMENT;
#1
6
You first need to send theALTER
batch to the server before executing the UPDATE
. Add GO
after the ALTER
statement
首先需要在执行UPDATE之前将ALTER批处理发送到服务器。在ALTER语句后添加GO
#2
9
Add the batch delimiter and the table name in your update statement.
在update语句中添加批处理分隔符和表名。
ALTER TABLE TASK_COMMENT ADD COMMENT_TMP text;
GO
UPDATE TASK_COMMENT SET COMMENT_TMP = COMMENT;