Shadow Walker
Shadow Walker

Reputation: 1199

How to add column description in CREATE TABLE DDL

I want to add column descriptions to a table I am creating in BigQuery.

When I try to execute below query:

CREATE TABLE mydataset.newtable (
  x STRING(10) "denotes value of x",
  y STRING(10) "denotes value of y",
  z BIGNUMERIC(35) "denotes value of z"
) AS (SELECT x, y, z FROM table2)

I get an error:

Syntax error: Expected ")" or "," but got string literal "denotes value of x"

What am I missing?

Upvotes: 2

Views: 1184

Answers (1)

Salman Arshad
Salman Arshad

Reputation: 272106

According to the documentation this should work:

CREATE TABLE mydataset.newtable (
  x STRING(10)     OPTIONS(description="denotes value of x"),
  y STRING(10)     OPTIONS(description="denotes value of y"),
  z BIGNUMERIC(35) OPTIONS(description="denotes value of z")
)

Upvotes: 5

Related Questions