SQL Server Stored Procedure Settings

What are the best SET options that you must complete before creating a stored procedure?

eg

SET QUOTED_IDENTIFIER  OFF
SET ANSI_NULLS  ON 

CREATE PROCEDURE HelloWorld
AS
    --also, should any be issued within the procedure body?
    PRINT 'hello world!'
    RETURN 0
GO

In the best case, I mean the most preferred settings.

+3
source share
3 answers

To create stored procedure creation , then only two are important during parsing.

SET ANSI_NULLS
SET QUOTED_IDENTIFIER

And they must be ON to work with the new SQL Server features that only work on them.

SET, , SET ANSI_NULLS SET QUOTED_IDENTIFIER. , SET ANSI_NULLS SET QUOTED_IDENTIFIER, , . , SET .

: http://msdn.microsoft.com/en-us/library/ms190356.aspx

,

SET ANSI_DEFAULTS ON

(ON) ISO:

SET ANSI_NULLS
SET CURSOR_CLOSE_ON_COMMIT
SET ANSI_NULL_DFLT_ON
SET IMPLICIT_TRANSACTIONS
SET ANSI_PADDING
SET QUOTED_IDENTIFIER
SET ANSI_WARNINGS

, , , INDEXED VIEWs

SET ARITHABORT ON
SET CONCAT_NULL_YIELDS_NULL ON
SET NUMERIC_ROUNDABORT OFF
+5

( - ). ; set nocount

+1

Usually I do not set any parameters before proc. In proc, Verily use SET NOCOUNT ON, and if it's just selectSET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED

-2
source

All Articles