SA0256 : A cursor with the same name is declared earlier. Avoid reusing cursor names
The topic describes the SA0256 analysis rule.
A cursor with the same name is declared earlier. Avoid reusing cursor names
The rule checks T-SQL code for cursor declarations and reports when a cursor name is declared more than once in the current scope.
It is not a good practice to re-declare cursor and should be avoided.
The rule has a Batch scope and is applied only on the SQL script.
Rule has no parameters.
The rule does not need Analysis Context or SQL Connection.
Design Rules, New Rules
1DECLARE vend_cursor CURSOR FOR SELECT * FROM Purchasing.Vendor 2 3FETCH NEXT FROM vend_cursor 4 5OPEN vend_cursor 6 7CLOSE vend_cursor 8 9DEALLOCATE vend_cursor 10 11DECLARE vend_cursor CURSOR FOR SELECT * FROM Purchasing.Vendor
|1||SA0256 : The declared cursor name [vend_cursor] is used in a previous declaration. Avoid reusing cursor names.||11||8|
© Ubitsoft Ltd. All Rights Reserved.