[SQL SERVER] [Performance] importance Null value (2)

[SQL SERVER] [Performance] importance Null value (2)


Previous Null I talked about some of the considerations, about the following two points.

1. The data in the table specified explicitly used Not Null and Default Values

2. The data in the table do not allow Null values ​​as much as possible.

Let's look at this database-related Null option.

image

ANSI NULL defaults :( Please specify keywords, does not rely on database options)

Null you override the default attributes of the new rows of data .

image

(Capturing section)

参考: SET ANSI_NULL_DFLT_ON (Transact-SQL) 、SET ANSI_NULL_DFLT_OFF (Transact-SQL)

ANSI NULLS Enabled :( recommend True)

When used in conjunction with the specified Null value, equal to (=) and not equal to (<>) ISO standard behavior of the comparison operator.

image

(Capturing section)

Return 0 pen

set ansi_nulls on
select * from testnull
where c1 = NULL 

image

All returns Null data

set ansi_nulls off
select * from testnull
where c1 = NULL 

image

Reference: SET ANSI_NULLS (Transact-SQL)

ANSI filled enabled :( recommend True)

How control data stored than the defined size of the data line rows shorter value,

And how to save char, varchar, binary and varbinary data contains the value trailing spaces.

image

(Capturing section)

参考:SET ANSI_PADDING (Transact-SQL)

 

ANSI Warnings Enabled :( set according to demand, does not rely on database options)

Specifies the number of error conditions ISO standard behavior.

image

(Capturing section)

参考:SET ANSI_WARNINGS (Transact-SQL)

 

Null Null :( series produced recommendations True)

The series as a result of the control whether Null value or an empty string processing.

image

image

(Capturing section)

 

SET CONCAT_NULL_YIELDS_NULL on
select 'rico'+null

image

 

SET CONCAT_NULL_YIELDS_NULL off
select 'rico'+null

image 

参考:SET CONCAT_NULL_YIELDS_NULL (Transact-SQL)

Original: Large column  [SQL SERVER] [Performance] importance Null value (2)


Guess you like

Origin www.cnblogs.com/chinatrump/p/11514488.html