问题
According to MSDN BOL (Books Online) on SET ANSI_PADDING,
In a future version of Microsoft SQL Server ANSI_PADDING will always be ON and any applications that explicitly set the option to OFF will produce an error. Avoid using this feature in new development work, and plan to modify applications that currently use this feature.
I have never used this option but it looks like it can actually save a lot of database spaces for char
and varbinary
fields if used correctly.
Why is SET ANSI_PADDING
becoming obsolete, other than the fact that it is not ANSI-compliant?
Are there any good reasons why?
回答1:
Not an answer, just an opinion:
I personally would like to believe they're removing it because it's a nulling pain in the null. If one database object is created, used, referenced, or whatever with it ON, a second one is done so with it OFF, and you try to work with both at the same time (two tables, procedure referencing table, etc.), your results may be inconsistant or may not make sense, and it will take you Forever to figure out what's going on.
(There are other SET settings like this, and worse. I hope they deprecate them all.)
回答2:
That feature wasn't used at all and it isn't ANSI compliant also, so they will remove it. The space saving on can be done regardless of ansi_padding, sql server can remove the padding internally.
来源:https://stackoverflow.com/questions/1415726/why-is-sql-server-deprecating-set-ansi-padding-off