I have a SQL Server table with multiple columns 2 of which are Kwd
and UserName
. I am trying to update all values in column UserName
with values from column Kwd
. Both columns are of type nvarchar
.
I am using the below query.
UPDATE test_table1
SET UserName = Kwd
I have also tried
SET a.UserName = B.Kwd
FROM test_table1 a
INNER JOIN test_table1 b ON a.PelID = b.PelID
However it updates all column with value "sa", what could be wrong?
Update 1:
I have tried testing an easier approach to see what will happen When I run the query:
UPDATE test_table1
SET UserName = 'test'
it still updates all rows with value sa