Click or drag to resize

SA0255 : Consider using extended cursor declaration syntax instead of the ISO syntax

The topic describes the SA0255 analysis rule.

Message

Consider using extended cursor declaration syntax instead of the ISO syntax

Description

The rule checks T-SQL code for cursor declaration statements, which use the ANSI/ISO SQL 92 compliant syntax.

The DECLARE CURSOR statement accepts both ANSI/ISO syntax and the extended T-SQL syntax. The extended syntax is recommended as it supports many more options that the ISO syntax.

Scope

The rule has a Batch scope and is applied only on the SQL script.

Parameters

Rule has no parameters.

Remarks

The rule does not need Analysis Context or SQL Connection.

Categories

Design Rules, New Rules

Additional Information
Example Test Script
SQL
1DECLARE vend_cursor1 SCROLL CURSOR FOR SELECT * FROM Purchasing.Vendor
2DECLARE vend_cursor2 CURSOR FOR SELECT * FROM Purchasing.Vendor  FOR READ ONLY;
3DECLARE vend_cursor3 INSENSITIVE CURSOR FOR SELECT * FROM Purchasing.Vendor
4DECLARE vend_cursor4 INSENSITIVE SCROLL CURSOR FOR SELECT * FROM Purchasing.Vendor 
5DECLARE vend_cursor5 CURSOR FOR SELECT VendorID, Name, LastName FROM Purchasing.Vendor FOR UPDATE OF Name, LastName

Analysis Results

 MessageLineColumn
1SA0255 : Consider using extended cursor declaration syntax instead of the ISO syntax.18
2SA0255 : Consider using extended cursor declaration syntax instead of the ISO syntax.28
3SA0255 : Consider using extended cursor declaration syntax instead of the ISO syntax.38
4SA0255 : Consider using extended cursor declaration syntax instead of the ISO syntax.48
See Also

Other Resources