13.07.2015 Views

Caché Transact-SQL (TSQL) Migration Guide - InterSystems ...

Caché Transact-SQL (TSQL) Migration Guide - InterSystems ...

Caché Transact-SQL (TSQL) Migration Guide - InterSystems ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

T<strong>SQL</strong> CommandsCREATE TABLE mytest (MyId INT PRIMARY KEY,LastName VARCHAR(20) CONSTRAINT unq_lname UNIQUECONSTRAINT nonull_lname NOT NULL)<strong>Caché</strong> <strong>SQL</strong> does not retain constraint names. Therefore these names cannot be used by a subsequent ALTER TABLEstatement.The table column constraints DEFAULT, IDENTITY, NULL, NOT NULL, PRIMARY KEY, [FOREIGN KEY] REFER-ENCES (the keywords FOREIGN KEY are optional), UNIQUE, CLUSTERED, and NONCLUSTERED are supported.The table constraint FOREIGN KEY REFERENCES is supported.The column definition DEFAULT values can include the following T<strong>SQL</strong> functions: CURRENT_TIMESTAMP, CUR-RENT_USER, GETDATE, HOST_NAME, ISNULL, NULLIF, and USER.The column definition IDENTITY constraint is supported and assigned a system-generated sequential integer. The IDENTITYarguments seed and increment are parsed, but ignored.The table constraint clauses WITH, ON, and TEXTIMAGE ON are parsed for compatibility, but are ignored. The clause for the UNIQUE or PRIMARY KEY constraint is parsed for compatibility, but is ignored.The following <strong>SQL</strong> Server parenthesized WITH options in a table constraint are parsed but ignored:ALLOW_PAGE_LOCKS, ALLOW_ROW_LOCKS, DATA_COMPRESSION, FILLFACTOR, IGNORE_DUP_KEY,PAD_INDEX, and STATISTICS_NORECOMPUTE.The column constraints CLUSTERED and NONCLUSTERED are parsed for compatibility, but are ignored.The CHECK column constraint is not supported. If a CHECK constraint is encountered while compiling T<strong>SQL</strong> source<strong>Caché</strong> generates an error message indicating that CHECK constraints are not supported. This error is logged in the compilelog (if active), and the source is placed in the unsupported log (if active).If the table already exists, a -201 error is issued.4.1.2 ALTER TABLEThe ALTER TABLE statement allows you to modify the definition of a table, its fields, and their data types and constraints.The following syntactical forms are supported:ALTER TABLE ADD ALTER TABLE DROP ALTER TABLE ADD COLUMN ALTER TABLE ALTER COLUMN ALTER TABLE REPLACE DEFAULT { | USER | NULL }ALTER TABLE DROP COLUMN ALTER TABLE ADD ALTER TABLE DROP ALTER TABLE ADD CONSTRAINT DEFAULT FORALTER TABLE ADD CONSTRAINT FOREIGN KEYALTER TABLE DROP CONSTRAINT ALTER TABLE DISABLEThe following syntax is supported for ALTER TABLE...ADD:ALTER TABLE [ WITH CHECK | WITH NOCHECK ]ADD FOREIGN KEY (col1[,col2[,...]])REFERENCES table(col1[,col2[,...]])The ALTER TABLE...ADD CONSTRAINT...DEFAULT syntax does not create a column constraint. Instead, it performsthe equivalent of an ALTER TABLE...ALTER COLUMN...DEFAULT statement. This means that <strong>Caché</strong> establishes18 <strong>Caché</strong> <strong>Transact</strong>-<strong>SQL</strong> (T<strong>SQL</strong>) <strong>Migration</strong> <strong>Guide</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!