Pranay B
Pranay B

Reputation: 67

Update a column using subquery or join

I need to update the 'DA_ArticleDetails' column of table1 using the resul from the select query. I tried something like this:

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

but its giving error:

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.

Could anyone help me how to update the column?

Upvotes: 0

Views: 47

Answers (2)

Kiran Hegde
Kiran Hegde

Reputation: 3681

You can simply call the following query

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

Upvotes: 2

Jeremy Cook
Jeremy Cook

Reputation: 22063

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

Upvotes: 2

Related Questions