Snownew
Snownew

Reputation: 33

Snowflake table stage data loading

I tried to load data into table using table stage, but when I try to query from the table, it is giving an error such as no such column present.

Copy into Table name from @/table stage id
update Employee  set first name='Neha' where first name='Arjun';

e.g Employee table has column such as first name and need to change value from Arjun to Neha

it gives an error " SQL COMPILATION ERROR: syntax error line 1 at position 2 unexpected 'name' "

Any restriction with table stage?

Upvotes: 1

Views: 355

Answers (1)

Simeon Pilgrim
Simeon Pilgrim

Reputation: 25903

Object identifier rules

insert doc's here

Unquoted object identifiers:

  • Start with a letter (A-Z, a-z) or an underscore (“_”).
  • Contain only letters, underscores, decimal digits (0-9), and dollar signs (“$”).
  • Are stored and resolved as uppercase characters (e.g. id is stored and resolved as ID).

If you put double quotes around an identifier (e.g. “My identifier with blanks and punctuation.”), the following rules apply:

  • The case of the identifier is preserved when storing and resolving the identifier (e.g. "id" is stored and resolved as id).
  • The identifier can contain and can even start with any ASCII character from the blank character (32) to the tilde (126).

To use the double quote character inside a quoted identifier, use two quotes. For example:

create table "quote""andunquote""" ...

creates a table named:

quote"andunquote"

where the quotation marks are part of the name.

Phew,

So some testing of that:

CREATE TABLE table_name(first_name string);
status
Table TABLE_NAME successfully created.
CREATE TABLE table_name(first name string);

Syntax error: unexpected 'name'. (line 8)

CREATE TABLE table name(first_name string);

Syntax error: unexpected 'table'. (line 12)

syntax error line 1 at position 23 unexpected '('. (line 12)

CREATE TABLE "table name"(first_name string);
status
Table table name successfully created.
CREATE OR REPLACE TABLE "table name"("first name" string);
status
Table table name successfully created.

Thus for you code:

Copy into "Table name" from @/"table stage id";

and

update Employee set "first name"='Neha' where "first name"='Arjun';

Upvotes: 1

Related Questions