Issue with inserting values into a table using sql query

I am trying to insert values from a json form into a snowflake table using an INSERT INTO sql statement. When I hover over the values in the query (such as ISO_COUNTRY_CODE), it shows me a string format of the value when is what I want, however when I run the query it says the identifier is invalid. I have also disabled converting queries to prepared statements but no luck.

Any idea how I can fix this?

I wouldn't uncheck the prepared statement but would look at the data itself to ensure it is formatted as a string....wherever you are getting the data from.... if it's a form is it from a text input field, etc..

1 Like

have you double checked the column type? there are types that can look like a string but produce this error, like if it's actually an enum then the error would mean that "FRA" isn't a possible enum value. there could be other restrains on the column too, like maybe it requires 4 chars or more or something.

1 Like

As a check, if you copy the SQL statement as text (i.e. with all of the values converted to text as it shows when you are working on the query) and run it in a new query, does the insert work?

1 Like

Hi @abalamur,

We always recommend using GUI mode, if possible, because it handles some of the syntax for you. Curious if that method also results in the same error?

As folks mention above, it would be helpful to get some more info about the data type or confirm if a hardcoded query works as expected