I'm trying to alter the table named company, but it will display the error
syntax error at or near "("
LINE 2: ADD( company_access_level short NOT NULL,
My syntax is
ALTER TABLE company
ADD company_access_level short NOT NULL,
workgroup_level short NOT NULL,
Company Logon URL character varying NOT NULL,
Company Logoff URL character varying NOT NULL
Thanks
The basic syntax of an ALTER TABLE command to add a New Column in an existing table is as follows. ALTER TABLE table_name ADD column_name datatype; The basic syntax of an ALTER TABLE command to DROP COLUMN in an existing table is as follows.
The ALTER TABLE statement is used to add, delete, or modify columns in an existing table.
ALTER TABLE changes the structure of a table. For example, you can add or delete columns, create or destroy indexes, change the type of existing columns, or rename columns or the table itself. You can also change characteristics such as the storage engine used for the table or the table comment.
I just tried this fixed syntax in postgressql and it worked. There is no short
datatype though so you'll have to use something else (maybe smallint?) If your table contains data this script will fail for the reasons in John's answer.
ALTER TABLE company
ADD company_access_level int NOT NULL,
ADD workgroup_level int NOT NULL,
ADD "Company Logon URL" character varying NOT NULL,
ADD "Company Logoff URL" character varying NOT NULL
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With