By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
CREATE TABLE foo ( a int );
INSERT INTO foo VALUES (1),(2),(3);
3 rows affected
ALTER TABLE foo ADD b varchar;
UPDATE foo SET b = CAST( a AS varchar );
ALTER TABLE foo DROP COLUMN a;
Msg 207 Level 16 State 1 Line 2
Invalid column name 'b'.
SELECT * FROM foo;
a |
---|
1 |
2 |
3 |