How do I copy the column A data to column B?

Board Table
ID      ColumnA                 ColumnB
1        Pending
2         Pending
3         Escalated
4          Pending
5         Completed

Hello. I am using MS-SQL 2005
I need to make few data transfer.
I have a table called Board Table with Column A and B.
Column A data type is nvarchar(20) and Column B is a new column with data type  int.
Also column A has 3 different values that is all mixed in the column(Pending,Escalated,Completed)
I want to make a data copy to ColumnA to ColumnB. If it's Pending, value can 1. If it's Escalated, value can be 2, Completed value can be 3.
How do I make those kind of query.
Thank you
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

UPDATE [Board Table]
              SET ColumnB = CASE WHEN Ltrim(Rtrim(A)) = 'Pending' THEN 1
                                                  WHEN Ltrim(Rtrim(A)) = 'Escalated' THEN 3

Use additional WHEN statements for the remaining of your options.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Faiga DiegelSr Database EngineerCommented:
UPDATE BoardTable
SET ColumnB = (CASE WHEN ColumnA = 'Pending' THEN 1
                          CASE WHEN ColumnA= 'Escalated' THEN 2
                          CASE WHEN ColumnA = 'Completed' THEN 3 END)
erin027Author Commented:
Thank you guys.
It worked. One more question
That if I just wanted to copy exactly same data to ColumnB if both column has same datatype?
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

UPDATE BoardTable SET ColumnB = ColumnA
erin027Author Commented:
Thank you
Faiga DiegelSr Database EngineerCommented:
yes, It should have at least the same data type. Or you would need to convert.

erin027Author Commented:
When I copy columnA to columnB with your query:
UPDATE BoardTable SET ColumnB = ColumnA

both column's data got NULL.

Why is that?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2005

From novice to tech pro — start learning today.