使用子查询或联接更新列

时间:2014-07-23 14:10:34

标签: sql sql-server

我需要使用select查询中的结果更新table1的'DA_ArticleDetails'列。我试过这样的事情:

UPDATE table1 
SET [DA_ArticleDetails] =
(
select RIGHT([DA_ArticleDetails], 8000)
from table1
)

但是给出错误:

Msg 512, Level 16, State 1, Line 1
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
The statement has been terminated.

有人可以帮我更新专栏吗?

2 个答案:

答案 0 :(得分:2)

UPDATE table1 
SET [DA_ArticleDetails] = RIGHT([DA_ArticleDetails], 8000)
from table1

答案 1 :(得分:2)

您只需拨打以下查询

即可
UPDATE table1 
SET [DA_ArticleDetails] =RIGHT([DA_ArticleDetails], 8000)