为什么 SQL Server 不推荐使用 SET ANSI_PADDING OFF?
根据 MSDN BOL(在线图书)SET ANSI_PADDING
< /a>,
在 Microsoft SQL Server 的未来版本中,ANSI_PADDING 将始终为 ON,任何显式将该选项设置为 OFF 的应用程序都会产生错误。避免在新的开发工作中使用此功能,并计划修改当前使用此功能的应用程序。
我从未使用过此选项,但如果使用正确,它看起来实际上可以为 char
和 varbinary
字段节省大量数据库空间。
除了不符合 ANSI 标准之外,为什么 SET ANSI_PADDING
变得过时了?
有什么好的理由吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不是答案,只是一个意见:
我个人愿意相信他们正在删除它,因为这是零中的零痛苦。如果创建、使用、引用一个数据库对象或在其处于 ON 状态下执行其他操作,则在其 OFF 状态下创建、使用、引用第二个数据库对象,并且您尝试同时使用这两个对象(两个表、过程引用表等),您的结果可能不一致或没有意义,您需要永远才能弄清楚发生了什么。
(还有其他类似的 SET 设置,甚至更糟糕。我希望他们全部弃用。)
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.)
该功能根本没有被使用,而且也不符合 ANSI 标准,因此他们将删除它。无论ansi_padding如何,都可以节省空间,sql server可以在内部删除填充。
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.