user2684098
user2684098

Reputation: 31

Teradata Alter Table Command to Modify existing column data type from varchar to char with same length

Within Teradata, when executing an ALTER TABLE command to modify the data type for an existing column from VARCHAR(10) to CHAR(10), I receive a 3558 error indicating that the specified attribute can not be altered. Is there an alternate method of coding this to achieve the desired objective or does the column need to be dropped and re-created in order to change the data type?

Upvotes: 3

Views: 21770

Answers (1)

dnoeth
dnoeth

Reputation: 60502

You can't modify the data type when the internal storage changes and this is the case for VARCHAR <-> CHAR.

Instead of ADD CHAR -> UPDATE CHAR from VARCHAR (needs a huge Transient Journal) -> DROP VARCHAR you better create a new table -> INSERT/SELECT (no TJ) -> DROP/RENAME.

Edit: As Rob Paller suggested, using MERGE INTO instead of INSERT SELECT will avoid spooling the source table.

Upvotes: 4

Related Questions