Creates new tables and optional integrity constants.
Transact-SQL Syntax
create table [database.[owner.]table_name (column_name datatype [default {constant_expression | user | null}] {[{identity | null | not null}] | [[constraint constraint_name] {{unique | primary key} [clustered | nonclustered] [with {fillfactor | max_rows_per_page} = x] [on segment_name] | references [[database.]owner.]ref_table [(ref_column)] | check (search_condition)}]}...
| [constraint constraint_name] {{unique | primary key} [clustered | nonclustered] (column_name [{, column_name}...]) [with {fillfactor | max_rows_per_page} = x] [on segment_name] | foreign key (column_name [{, column_name}...]) references [[database.]owner.]ref_table [(ref_column [{, ref_column}...])] | [check (search_condition)}
[{, {next_column | next_constraint}}...])
[with max_rows_per_page = x][on segment_name]
ODBC Syntax
CREATE TABLE base_table_name (column_element[,column_element]...)
column_element::=column_definition| table_constraint_definition
column_definition:= column_identifier datatype [DEFAULT default_value] [column_constraint_definition [column_constraint_definition]...]
default_value::=literal|NULL|USER
column_constraint_definition::= NOT NULL |UNIQUE|PRIMARY KEY |REFERENCES ref_table_name referenced_columns
table_constraint_definition::= UNIQUE(column_identifier[,column_identifier]...) |PRIMARY KEY(column_identifier[,column_identifier]...] |CHECK(search_condition) |FOREIGN KEY referencing_columns REFERENCES ref_table_name referenced_columns
create table titles (title_id tid not null, title varchar(80) not null, type char(12) not null, pub_id char(4) null, price money null, advance money null, total_sales int null, notes varchar(200) null, pubdate datetime not null, contract bit not null)
Transact-SQL Specification |
Transformed to |
---|---|
null |
null |
not null |
not null |
<nothing> |
not null |
The access service attempts to change the Transact-SQL datatype to the primary ODBC datatype.
If the ODBC driver does not support the ODBC datatype, the access service uses the secondary ODBC datatype.
If the secondary ODBC datatype is also unsupported, the access service uses the final ODBC datatype.
Because the ODBC driver may not support extended datatypes such as Tinyint and Bit, a core ODBC type is associated with those datatypes as the second and third choices.
The size of the char value for Nchar and Nvarchar conversions should be doubled to accommodate the double-byte characters possible.
For Text secondary and final ODBC datatype values, and Image final ODBC datatype values, the original value can be truncated to fit the “transformed to” value.
Binary, Varbinary, and Image final ODBC datatype values can go through code set translation, which is not desirable for binary datatypes.