0
votes

I am trying to alter my table ADDRESS for column ADDRESS_TYPE from VARCHAR(10) to VARCHAR(50).

I tried

ALTER TABLE ADDRESS ALTER ADDRESS_TYPE VARCHAR(50);
ALTER TABLE ADDRESS MODIFY ADDRESS_TYPE VARCHAR(50);
ALTER TABLE ADDRESS ALTER COLUMN ADDRESS_TYPE VARCHAR(50);
ALTER TABLE ADDRESS CHANGE ADDRESS_TYPE VARCHAR(50);

none of them work and i got a DB2 SQL error:

SQLCODE=-104, SQLSTATE=42601.

This table is part of constraint in a few other tables. Trying to get the correct ALTER statement to modify the max length.

2
I've removed apparent superfluous database tags. Please only tag products in question. - HoneyBadger

2 Answers

1
votes

Since you're using DB2, your syntax should be

ALTER TABLE ADDRESS
      ALTER COLUMN ADDRESS_TYPE SET DATA TYPE VARCHAR(50)
0
votes

In DB2, syntaxes differ from SQL. Hope the below command will work for you:

ALTER TABLE ADDRESS ALTER COLUMN ADDRESS_TYPE SET DATA TYPE VARCHAR(50);