2

In the database options, the ANSI NULLS Enabled option is set to false. I can further confirm this by running:

SELECT DATABASEPROPERTYEX('mydb', 'IsAnsiNullsEnabled') 

which gives me 0.

Interestingly, whenever I open a new query window from the same database and run this:

IF (NULL = NULL) BEGIN print 'true' END ELSE begin PRINT 'false' END 

it gives me 'false' every time. It only gives me 'true' if I manually turn ansi_nulls off by running:

SET ANSI_NULLS OFF 

Why is this?

1 Answer 1

2

If you are using Management Studio (SSMS), then you may have it set in your default query options.

To check this, click "Tools..Options" to open the Option dialog. Then navigate to "Query Execution > SQL Server > ANSI".

The database setting is a default and is only used if there is no session, query or connection setting specified.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks Barry! That was it!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.