SET new_height = cast(s_height as VARCHAR(100)) To copy the data from the columns s_height to new_height, use the UPDATE statement with the cast() to change the data type. ![]() Step 2 – Copy data from the old to the new column. In this section, I will demonstrate how to alter/change the column type of s_height from integer to varchar(100) in AWS Redshift.įirst, create a new column new_height with the desired data type using ALTER TABLE ADD COLUMN statement.ĪLTER TABLE students add column new_height VARCHAR(100) Change Column Data Type from INT to VARCHAR(100) Let’s use the above steps and change the data type of a few columns in the above table.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |