Sql-server – sql server set implicit_transactions off and other options

sql server

I am still learning sql server somewhat and recently came across a select query in a stored procedure which was causing a very slow fill of a dataset in c#. At first I thought this was to do with .NET but then found a suggestion to put in the stored procedure:

set implicit_transactions off

this seems to cure it but I would like to know why also I have seen other options such as:

  • set nocount off
  • set arithabort on
  • set concat_null_yields_null on
  • set ansi_nulls on
  • set cursor_close_on_commit off
  • set ansi_null_dflt_on on
  • set ansi_padding on
  • set ansi_warnings on
  • set quoted_identifier on

Does anyone know where to find good info on what each of these does and what is safe to use when I have stored procedures setup just to query of data for viewing.

I should note just to stop the usual use/don't use stored procedures debate these queries are complex select statements used on multiple programs in multiple languages it is the best place for them.

Edit: Got my answer didn't end up fully reviewing all the options but did find

SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED

Sped up the complex queries dramatically, I am not worried about the dirty read in this instance.

Best Answer

This is the page out of SQL Server Books Online (BOL) that you want. It explains all the SET statements that can be used in a session. http://msdn.microsoft.com/en-us/library/ms190356.aspx