If I have the following table:
| name | value |
------------------
| A | 1 |
| B | NULL |
Where at the moment name is of type varchar(10)
and value is of type bit
.
I want to change this table so that value is actually a nvarchar(3)
however, and I don't want to lose any of the information during the change. So in the end I want to end up with a table that looks like this:
| name | value |
------------------
| A | Yes |
| B | No |
What is the best way to convert this column from one type to another, and also convert all of the data in it according to a pre-determined translation?
NOTE: I am aware that if I was converting, say, a varchar(50)
to varchar(200)
, or an int
to a bigint
, then I can just alter the table. But I require a similar procedure for a bit
to a nvarchar
, which will not work in this manner.