SQL Flow Field Guide

SET ANSI_DEFAULTS

Catalog support for SQL Server 2022 (16.x) and 2025 (17.x)

turns on a group of ISO settings at once (ANSI_NULLS, ANSI_PADDING, ANSI_WARNINGS, ANSI_NULL_DFLT_ON, CURSOR_CLOSE_ON_COMMIT, IMPLICIT_TRANSACTIONS, QUOTED_IDENTIFIER)

What changes

Input
none
Output or change
session state

Syntax at a glance

SET ANSI_DEFAULTS { ON | OFF }

Work example

A session or module needs the behavior controlled by SET ANSI_DEFAULTS for a stated reason.

Check when SQL Server reads the option, its scope, and how a reused connection is reset. Change one setting at a time in a test session.

Check your work SET ANSI_DEFAULTS. The statement is affected by SET ANSI_DEFAULTS as intended and the setting does not leak into the next session task.

Open Microsoft Learn for full syntax, permissions, and details for your version.