The topic describes the DF004 T-SQL code analysis rule.
PERFORMANCE
The SET statement is used within a stored procedure.
Changing the SET options for ANSI_DEFAULTS, ANSI_NULL_DFLT_OFF, ANSI_NULL_DFLT_ON, ANSI_PADDING, ANSI_WARNINGS, ARITHABORT, CONCAT_NULL_YIELDS_NULL, DATEFIRST, DATEFORMAT, LANGUAGE, NO_BROWSETABLE, or NUMERIC_ROUNDABORT leads to the recompilation of the affected stored procedure.
During execution or runtime, all SET statements operate, with the exception of those running at parse time, including SET FIPS_FLAGGER, SET OFFSETS, SET PARSEONLY, and SET QUOTED_IDENTIFIER.
CREATE PROCEDURE dbo.SelectUserData
AS BEGIN
SET NOCOUNT ON;
SET ANSI_WARNINGS OFF;
SELECT * FROM dbo.UserData;
END
GO
CREATE PROCEDURE dbo.SelectUserData
AS BEGIN
SET NOCOUNT ON;
/* remove usage of SET ANSI_WARNINGS*/
SELECT * FROM dbo.UserData;
END
GO