SET ANSI_WARNINGS OFF should not used in stored procedures or indexed views

tsql

(Christian Rohr ) #1

A good rule suggestion:

  • If SET ANSI_WARNINGS OFF is used on the Beginn of a procedure DML statements to tables with computed columns, which contains an index on there going to be fail: https://nocolumnname.blog/tag/index/

  • snippet of Noncompliant Code:
    CREATE PROCEDURE [name]
    AS
    BEGIN

    SET ANSI_WARNINGS OFF

    [Furter code]

    End

  • Snippet of Compilant Code
    CREATE PROCEDURE [name]
    AS
    BEGIN

    [Further code]

    END

  • external references and/or language specifications: https://nocolumnname.blog/tag/index

  • type : Bug, Code Smell