Skip to content

Latest commit

 

History

History
60 lines (45 loc) · 2.61 KB

set-offsets-transact-sql.md

File metadata and controls

60 lines (45 loc) · 2.61 KB
title description author ms.author ms.date ms.service ms.subservice ms.topic f1_keywords helpviewer_keywords dev_langs
SET OFFSETS (Transact-SQL)
SET OFFSETS (Transact-SQL)
WilliamDAssafMSFT
wiassaf
06/10/2016
sql
t-sql
reference
SET_OFFSETS_TSQL
OFFSETS_TSQL
SET OFFSETS
OFFSETS
position relative to start of statement [SQL Server]
OFFSETS option
offsets [SQL Server]
SET OFFSETS statement
TSQL

SET OFFSETS (Transact-SQL)

[!INCLUDE SQL Server Azure SQL Database Azure SQL Managed Instance]

Returns the offset (position relative to the start of a statement) of specified keywords in [!INCLUDEtsql] statements to DB-Library applications.

Important

[!INCLUDEssNoteDepFutureAvoid]

:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions

Syntax

  
SET OFFSETS keyword_list { ON | OFF }  

Arguments

keyword_list
Is a comma-separated list of [!INCLUDEtsql] constructs including SELECT, FROM, ORDER, TABLE, PROCEDURE, STATEMENT, PARAM, and EXECUTE.

Remarks

SET OFFSETS is used only in DB-Library applications.

The setting of SET OFFSETS is set at parse time and not at execute time or run time. Setting at parse time means that if the SET statement is present in the batch or stored procedure, the setting takes effect, regardless of whether code execution actually reaches that point; and the SET statement takes effect before any statements are executed. For example, even if the set statement is in an IF...ELSE statement block that is never reached during execution, the SET statement still takes effect because the IF...ELSE statement block is parsed.

If SET OFFSETS is set in a stored procedure, the value of SET OFFSETS is restored after control is returned from the stored procedure. Therefore, a SET OFFSETS statement specified in dynamic SQL does not have any effect on any statements following the dynamic SQL statement.

SET PARSEONLY returns offsets if the OFFSETS option is ON and no errors occur.

Permissions

Requires membership in the public role.

See Also

SET Statements (Transact-SQL)
SET PARSEONLY (Transact-SQL)