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> CommandsFor further details on data types, refer to the T<strong>SQL</strong> Constructs chapter of this document.4.5.2 SETUsed to assign a value to a local variable:DECLARE @var CHAR(20)SET @var='hello world'Used to set a system setting:These settings have immediate effect at parse time, whether inside a stored procedure or not. The change persists untilanother SET command alters it – even if the SET is made inside a stored procedure, and accessed outside the SP or inanother SP.The following SET variables are supported:• SET ANSI_NULLS Permitted values are SET ANSI_NULLS ON and SET ANSI_NULLS OFF. If ANSI_NULLSOFF, a=b is true if (a=b OR (a IS NULL) AND (b IS NULL)).• SET DATEFIRST number• SET IDENTITY_INSERT Permitted values are SET IDENTITY_INSERT ON and SET IDENTITY_INSERT OFF.If ON, an INSERT statement can specify an identity column value.• SET NOCOUNT Permitted values are SET NOCOUNT ON and SET NOCOUNT OFF. When set to ON, messages indicatingthe number of rows affected by a query are suppressed. This can have significant performance benefits.• SET QUOTED_IDENTIFIER Permitted values are SET QUOTED_IDENTIFIER ON and SET QUOTED_IDENTIFIEROFF. When SET QUOTED_IDENTIFIER is on, double quotes are parsed as delimiting a quoted identifier. When SETQUOTED_IDENTIFIER is off, double quotes are parsed as delimiting a string literal. The preferable delimiters forstring literals are single quotes.• SET ROWCOUNT Set to an integer. Affects subsequent SELECT, INSERT, UPDATE, or DELETE statements to limitthe number of rows affected. In a SELECT statement, ROWCOUNT takes precedence over TOP: if ROWCOUNT isless than TOP, the ROWCOUNT number of rows is returned; if TOP is less than ROWCOUNT, the TOP number ofrows is returned. ROWCOUNT remains set for the duration of the process or until you revert it to default behavior.To revert to default behavior, SET ROWCOUNT 0. If you specify a fractional value, ROWCOUNT is set to the nextlarger integer.• SET TRANSACTION ISOLATION LEVEL See <strong>Transact</strong>ion Statements below.The following SET variables are parsed, but ignored:• SET DATEFORMAT• SET TEXTSIZE4.6 <strong>Transact</strong>ion Statements<strong>Caché</strong> T<strong>SQL</strong> provides support for transactions, including named transaction names. It does not support savepoints. Distributedtransactions are not supported.4.6.1 SET TRANSACTION ISOLATION LEVELSupported for the following forms only:26 <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!