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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

T<strong>SQL</strong> Commands4.1.6 CREATE TRIGGERCreates a statement-level trigger.CREATE TRIGGER trigger_name {BEFORE | AFTER}{INSERT | DELETE | UPDATE [OF col1[,col2[,...]]]}[ORDER integer]ON table-name[ REFERENCING OLD [ROW] [AS] name |NEW [ROW] [AS] name |OLD TABLE [AS] identifier |NEW TABLE [AS] identifier ][,...][FOR EACH {ROW | STATEMENT}][WHEN (condition)][LANGUAGE {T<strong>SQL</strong> | <strong>SQL</strong> |OBJECTSCRIPT}]triggered statement<strong>Caché</strong> T<strong>SQL</strong> does not support row-level triggers.<strong>Caché</strong> T<strong>SQL</strong> supports BEFORE triggers. This is a <strong>Caché</strong>-specific extension to T<strong>SQL</strong> which is not provided in <strong>Transact</strong>-<strong>SQL</strong> software from other vendors.4.1.7 DROP TRIGGERDeletes a trigger definition. You can delete a single trigger or a comma-separated list of triggers.4.1.8 CREATE VIEWCREATE VIEW [owner.]view_name [(colname1 [,colname2 [,...]])][WITH ENCRYPTION | SCHEMABINDING | VIEW_METADATA]AS select_statement[WITH CHECK OPTION]There are two ways to specify the names of the view columns:• You can use the optional colname comma-separated list to specify view column names for the corresponding tablecolumns returned by the SELECT statement.• You can specify column aliases in the SELECT statement, and these aliases are used as the view column names.If neither is specified, the table column names are used as the view column names.The WITH ENCRYPTION, SCHEMABINDING, and VIEW_METADATA keywords are ignored.The select_statement cannot contain an ORDER BY clause. The select_statement can contain a UNION or UNION ALL.The optional WITH CHECK OPTION clause prevents an update through the view that makes the record inaccessible tothat view. It does this by checking the WITH clause in the SELECT statement. WITH CHECK OPTION binds to <strong>Caché</strong><strong>SQL</strong> using the default of CASCADE.4.1.9 DROP VIEWDeletes a view definition. You can delete a single view, or a comma-separated list of views. DROP VIEW ignores anonexistent view name and completes without error.20 <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!