Alter Table is column exists

Moderator: NorbertKrupa

Post Reply
Richie1
Newbie
Newbie
Posts: 1
Joined: Thu Jul 09, 2015 3:39 pm

Alter Table is column exists

Post by Richie1 » Thu Jul 09, 2015 3:49 pm

Hello

I have searched far and wide and I cannot find any code that will allow me to alter a table (drop the column) if the column exists in my HP Vertica database.
Can anyone help me please?
An example of this in postgreSql would look like the following.

Code: Select all

ALTER TABLE PORTALIQ.dimSourceTypeS DROP COLUMN IF EXISTS SourceKey;
Thank you

NorbertKrupa
GURU
GURU
Posts: 527
Joined: Tue Oct 22, 2013 9:36 pm
Location: Chicago, IL
Contact:

Re: Alter Table is column exists

Post by NorbertKrupa » Mon May 23, 2016 3:03 am

That syntax is not supported in Vertica's ALTER TABLE. You may want to check a system table of columns whether the column exists before running an ALTER TABLE.
Checkout vertica.tips for more Vertica resources.

Post Reply

Return to “Vertica SQL”