CREATE TABLE Statements
To create new Smartsheet entities, use CREATE TABLE statements.
CREATE TABLE Syntax
The CREATE TABLE statement specifies the table name and a comma-separated list of column names and the primary keys of the table, as shown in the following example:
CREATE TABLE <table_name> [ IF [ NOT EXISTS ] ]
(
{
<column_name> <data_type>
[ NOT NULL ]
[ DEFAULT <literal> ]
[ PRIMARY KEY ]
[ UNIQUE ]
} | PRIMARY KEY ( <column_name> [ , ... ] )
[ , ... ]
)
Columns definitions for data types which cannot be directly mapped to a Smartsheet data type (for example, boolean -> CHECKBOX) are mapped to the generic Smartsheet TEXT_NUMBER type (for example, datetime -> TEXT_NUMBER). In order for the add-in to identify the correct SQL data type for these columns later on during metadata retrieval, ensure that TypeDetectionScheme is set to RowScan; the default behavior. This applies to ALTER TABLE statements as well.
The following example statement creates a MyCustomers table on the Smartsheet server with name, age, and address columns:
CREATE TABLE IF NOT EXISTS [MyCustomers] (name VARCHAR(20), age INT, address VARCHAR(20))