'Snowflake not recognizing data type in ADD column
A little new to SQL. Created a new table from a copy in another database and am trying to add columns and update them so I can merge three tables into one.
For some reason when I try to add columns snowflake isn't recognizing my data type.
the code is something like:
ALTER TABLE CUSTOMERS
ADD COLUMNS
FIRSTNAME varchar(99999),
LASTNAME varchar(99999),
DATE timestamp_ntz(00:00:00.000);
But I keep receiving errors saying unexpected 'varchar'. I am not sure what I am missing here, but I need the data types to match my other table so I can update it.
Solution 1:[1]
Correct syntax should use COLUMN or skip it at all, timestamp_ntz(00:00:00.000); is also incorrect as parameter should be integer indicating precision:
CREATE OR REPLACE TABLE CUSTOMERS(i INT);
ALTER TABLE CUSTOMERS
ADD
FIRSTNAME varchar(99999),
LASTNAME varchar(99999),
DATE timestamp_ntz(3);
ALTER TABLE CUSTOMERS
ADD COLUMN -- instead of COLUMNS
FIRSTNAME varchar(99999),
LASTNAME varchar(99999),
DATE timestamp_ntz(3);
SELECT * FROM CUSTOMERS;
Output:
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |

