I need to increase the size of the column from varchar(255) to varchar(1000).
What command I will use for that??
Increase size of the column
Moderator: NorbertKrupa
- JimKnicely
- Site Admin
- Posts: 1825
- Joined: Sat Jan 21, 2012 4:58 am
- Contact:
Re: Increase size of the column
Hi,
Use the ALTER TABLE ALTER COLUMN statement.
Example:
Use the ALTER TABLE ALTER COLUMN statement.
Example:
Code: Select all
dbadmin=> CREATE TABLE t (c VARCHAR(255));
CREATE TABLE
dbadmin=> \d t;
List of Fields by Tables
Schema | Table | Column | Type | Size | Default | Not Null | Primary Key | Foreign Key
--------+-------+--------+--------------+------+---------+----------+-------------+-------------
public | t | c | varchar(255) | 255 | | f | f |
(1 row)
dbadmin=> ALTER TABLE t ALTER COLUMN c SET DATA TYPE VARCHAR(1000);
ALTER TABLE
dbadmin=> \d t;
List of Fields by Tables
Schema | Table | Column | Type | Size | Default | Not Null | Primary Key | Foreign Key
--------+-------+--------+---------------+------+---------+----------+-------------+-------------
public | t | c | varchar(1000) | 1000 | | f | f |
(1 row)
Jim Knicely
Note: I work for Vertica. My views, opinions, and thoughts expressed here do not represent those of my employer.
Note: I work for Vertica. My views, opinions, and thoughts expressed here do not represent those of my employer.
Re: Increase size of the column
I used the alter table alter column command given by you:-
ALTER TABLE t ALTER COLUMN c SET DATA TYPE VARCHAR(1000);
But it is giving me error. Below is the error:-
'[Vertica][VerticaDSII] (20) An error occurred during query execution: ERROR: syntax error at or near "DATA" at character 93'
The present length of the column is VARCHAR(255) and i want increase it to VARCHAR(1000).
ALTER TABLE t ALTER COLUMN c SET DATA TYPE VARCHAR(1000);
But it is giving me error. Below is the error:-
'[Vertica][VerticaDSII] (20) An error occurred during query execution: ERROR: syntax error at or near "DATA" at character 93'
The present length of the column is VARCHAR(255) and i want increase it to VARCHAR(1000).
- JimKnicely
- Site Admin
- Posts: 1825
- Joined: Sat Jan 21, 2012 4:58 am
- Contact:
Re: Increase size of the column
Hi,
What version of Vertica are you running? The SET DATA TYPE option was a feature introduced in 6.0.
Check out this old thread:
viewtopic.php?f=5&t=155
I hope this helps!
What version of Vertica are you running? The SET DATA TYPE option was a feature introduced in 6.0.
Check out this old thread:
viewtopic.php?f=5&t=155
I hope this helps!
Jim Knicely
Note: I work for Vertica. My views, opinions, and thoughts expressed here do not represent those of my employer.
Note: I work for Vertica. My views, opinions, and thoughts expressed here do not represent those of my employer.