Skip to content
Advertisement

Create table in snowflake – Syntax

I am trying to create a table and insert rows into it. But it keeps giving me this syntax error. ERROR : SQL compilation error: syntax error line 3 at position 1 unexpected ‘EventName’. syntax

Any help would be appreciated.

create or replace table pd_press_dev._raz.ID (
     EventTypeID int
     EventName,
     EventDescription,
     EventCategoryName,
     SystemName,
     RecordChecksum,
     RecordAppend,
     RecordUpdate);
     
    INSERT INTO pd_press_dev._raz.ID 
    (-1,'NO_EVENT_TYPE','Event Type Not Defined','NO_EVENT_CATEGORY','INSITE','-770355665','0.00218634259259259','0.00218634259259259'); 

Advertisement

Answer

You need to type those columns, and you are missing a comma after the int of EnventTypeID

create or replace table pd_press_dev._raz.ID (
     EventTypeID int,
     EventName text,
     EventDescription text,
     EventCategoryName text,
     SystemName text,
     RecordChecksum text,
     RecordAppend text,
     RecordUpdate text);

and your insert needs a VALUES keyword:

INSERT INTO pd_press_dev._raz.ID values
    (-1, 'NO_EVENT_TYPE', 'Event Type Not Defined', 'NO_EVENT_CATEGORY', 
       'INSITE', '-770355665', '0.00218634259259259', '0.00218634259259259');      
SELECT * FROM ID;
EVENTTYPEID EVENTNAME EVENTDESCRIPTION EVENTCATEGORYNAME SYSTEMNAME RECORDCHECKSUM RECORDAPPEND RECORDUPDATE
-1 NO_EVENT_TYPE Event Type Not Defined NO_EVENT_CATEGORY INSITE -770355665 0.00218634259259259 0.00218634259259259
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement