Home All Groups Group Topic Archive Search About

Indexed view and database options

Author
15 Sep 2006 11:03 AM
jcvoon
Hi:

I'm using SQL2000 Ent, and I've created a indexed  view in my database,
my question is:

Is it ok to set the following options at database level (By default all
is OFF, correct me if I'm wrong) ?

SET ANSI_NULLS ON
SET ANSI_PADDING ON
SET ANSI_WARNINGS ON
SET ARITHABORT ON
SET CONCAT_NULL_YIELDS_NULL ON
SET QUOTED_IDENTIFIER ON

Otherwise I've to turn those option ON and OFF when I update the base
table reference in the indexed view.

Please Advice

Thanks
JCVoon

Author
15 Sep 2006 11:43 AM
Hari Prasad
Hi,

If it is me then I would encourage to turn off the options when required;
this will ensure that this behaviour change will not affect other
sessions/connections.
You could very well use the below code to verify and turn on the database
options.

IF sessionproperty('ARITHABORT') = 0 SET ARITHABORT ON
IF sessionproperty('CONCAT_NULL_YIELDS_NULL') = 0 SET
CONCAT_NULL_YIELDS_NULL ON
IF sessionproperty('QUOTED_IDENTIFIER') = 0 SET QUOTED_IDENTIFIER ON
IF sessionproperty('ANSI_NULLS') = 0 SET ANSI_NULLS ON
IF sessionproperty('ANSI_PADDING') = 0 SET ANSI_PADDING ON
IF sessionproperty('ANSI_WARNINGS') = 0 SET ANSI_WARNINGS ON
IF sessionproperty('NUMERIC_ROUNDABORT') = 1 SET NUMERIC_ROUNDABORT OFF
go

Since it is session level; once the session is closed automatically the
values for those database options will go back to default.


Thanks
Hari
SQL Server MVP

Show quoteHide quote
"jcvoon" <jcv***@maximas.com.my> wrote in message
news:1158318183.442425.93730@e3g2000cwe.googlegroups.com...
> Hi:
>
> I'm using SQL2000 Ent, and I've created a indexed  view in my database,
> my question is:
>
> Is it ok to set the following options at database level (By default all
> is OFF, correct me if I'm wrong) ?
>
> SET ANSI_NULLS ON
> SET ANSI_PADDING ON
> SET ANSI_WARNINGS ON
> SET ARITHABORT ON
> SET CONCAT_NULL_YIELDS_NULL ON
> SET QUOTED_IDENTIFIER ON
>
> Otherwise I've to turn those option ON and OFF when I update the base
> table reference in the indexed view.
>
> Please Advice
>
> Thanks
> JCVoon
>
Are all your drivers up to date? click for free checkup

Author
15 Sep 2006 12:00 PM
Dan Guzman
In most cases, you only need SET ARITHABORT ON (or sp_configure 'user
options' bit 64 at the server level).  The OLEDB and ODBC APIs commonly used
to connect to SQL Server automatically set all these options on except
ARITHABORT.  The order of precedence is:

1)  current connection settings
2)  database default settings
3)  server default settings

Also, be aware that  ANSI_NULLS and QUOTED_IDENTIFIER are 'sticky' options
so the settings in effect when a stored procedure is created are used at run
time.

--
Hope this helps.

Dan Guzman
SQL Server MVP

Show quoteHide quote
"jcvoon" <jcv***@maximas.com.my> wrote in message
news:1158318183.442425.93730@e3g2000cwe.googlegroups.com...
> Hi:
>
> I'm using SQL2000 Ent, and I've created a indexed  view in my database,
> my question is:
>
> Is it ok to set the following options at database level (By default all
> is OFF, correct me if I'm wrong) ?
>
> SET ANSI_NULLS ON
> SET ANSI_PADDING ON
> SET ANSI_WARNINGS ON
> SET ARITHABORT ON
> SET CONCAT_NULL_YIELDS_NULL ON
> SET QUOTED_IDENTIFIER ON
>
> Otherwise I've to turn those option ON and OFF when I update the base
> table reference in the indexed view.
>
> Please Advice
>
> Thanks
> JCVoon
>
Author
15 Sep 2006 12:22 PM
Kalen Delaney
Hi JCVoon

SET options are only applicable at the session level. There are database
properties with similar names, but they are not SET options. Also, in many,
if not most, cases, the database option is useless, because most client
tools set some of these options when they make a connection. So you might
have a database defined to use one option, but then every connection using
SET commands could override that. Many of the SET options set by your client
software are set behind the scenes, but you can see them if you trace your
connection with Profiler.

--
HTH
Kalen Delaney, SQL Server MVP


Show quoteHide quote
"jcvoon" <jcv***@maximas.com.my> wrote in message
news:1158318183.442425.93730@e3g2000cwe.googlegroups.com...
> Hi:
>
> I'm using SQL2000 Ent, and I've created a indexed  view in my database,
> my question is:
>
> Is it ok to set the following options at database level (By default all
> is OFF, correct me if I'm wrong) ?
>
> SET ANSI_NULLS ON
> SET ANSI_PADDING ON
> SET ANSI_WARNINGS ON
> SET ARITHABORT ON
> SET CONCAT_NULL_YIELDS_NULL ON
> SET QUOTED_IDENTIFIER ON
>
> Otherwise I've to turn those option ON and OFF when I update the base
> table reference in the indexed view.
>
> Please Advice
>
> Thanks
> JCVoon
>
Author
16 Sep 2006 5:25 AM
jcvoon
Hari Prasad, Dan Guzman, Kalen Delaney

Thanks.

Bookmark and Share

Post Thread options