SQLFLAGGER Function [Miscellaneous]

Returns the conformity of a given SQL statement to a specified standard.

Syntax

SQLFLAGGERsql-standard-stringsql-statement-string )

Parameters

Parameter

Description

sql-standard-string

The standard level against which to test compliance. Possible values are the same as for the SQL_FLAGGER_ERROR_LEVEL database option:

  • SQL:2003/Core Test for conformance to core SQL/2003 syntax.

  • SQL:2003/Package Test for conformance to full SQL/2003 syntax.

  • SQL:1999/Core Test for conformance to core SQL/1999 syntax.

  • SQL:1999/Package Test for conformance to full SQL/1999 syntax.

  • SQL:1992/Entry Test for conformance to entry-level SQL/1992 syntax.

  • SQL:1992/Intermediate Test for conformance to intermediate-level SQL/1992 syntax.

  • SQL:1992/Full Test for conformance to full-SQL/1992 syntax.

sql-statement-string

The SQL statement to check for conformance.

Returns

LONG VARCHAR

Note: The result data type is a LONG VARCHAR. If you use SQLFLAGGER in a SELECT INTO statement, you must have an Unstructured Data Analytics Option license or use CAST and set SQLFLAGGER to the correct data type and size.

Examples

The following statement shows an example of the message that is returned when a disallowed extension is found:

SELECT SQLFLAGGER( 'SQL:2003/Package', 'SELECT top 1 dummy_col FROM sys.dummy ORDER BY dummy_col' );

This statement returns the message '0AW03 Disallowed language extension detected in syntax near 'top' on line 1'.

The following statement returns '00000' because it contains no disallowed extensions:

SELECT SQLFLAGGER( 'SQL:2003/Package', 'SELECT dummy_col FROM sys.dummy' );

Usage

You can also use the iqsqlpp SQL Preprocessor Utility to flag any Embedded SQL that is not part of a specified set of SQL92. See Utility Guide > iqsqlpp SQL Preprocessor Utility.

Standards and Compatibility

  • SQL—Vendor extension to ISO/ANSI SQL grammar.

  • Sybase—Compatible with Adaptive Server Enterprise.