Default SET statements when creating/manipulating with indexes?
MSDN's documentation on SET
statements contains the following paragraph:
When you are creating and manipulating indexes on computed columns or indexed views, the SET options ARITHABORT, CONCAT_NULL_YIELDS_NULL, QUOTED_IDENTIFIER, ANSI_NULLS, ANSI_PADDING, and ANSI_WARNINGS must be set to ON. The option NUMERIC_ROUNDABORT must be set to OFF.
Setting these options could be done like this:
SET ARITHABORT, CONCAT_NULL_YIELDS_NULL, QUOTED_IDENTIFIER, ANSI_NULLS, ANSI_PADDING, ANSI_WARNINGS ON
SET NUMERIC_ROUNDABORT OFF
My question is -- is there any way to set these values by default, so that we don't have to set them manually every time we open a connection? Either system-开发者_JAVA百科wide, or perhaps for a specific user/login? And would there be any drawbacks to doing so?
They are set by SSMS already. And by clients normally. I've not had to set these explicitly for a very long time.
However, if desired, you can use sp_configure to specify "user options".
BTW: I haven't and won't set this. I'd suggest you don't touch and change any setting unless you have proven you need to do so...
End users don't need these options either. They are only needed for ALTER INDEX and CREATE INDEX (in this context) statements which aren't day to day end user commands.
Try sp_configure
I guess the one drawback of this approach is that if someone changes it later and your scripts depended on a certain set you scripts will break.
Check this may help: http://www.sqlservercentral.com/Forums/Topic1088175-391-1.aspx#bm1088396
精彩评论