473,772 Members | 3,603 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

incorrect settings: 'ANSI_NULLS., QUOTED_IDENTIFI ER'.

Getting an "incorrect settings: 'ANSI_NULLS., QUOTED_IDENTIFI ER'."
error after creating a view.

We wanted a composite unique constraint that ignored nulls, so we set
up a view using the following script:

/* --- start --- */
BEGIN TRANSACTION
SET QUOTED_IDENTIFI ER ON
SET ARITHABORT ON
SET NUMERIC_ROUNDAB ORT OFF
SET CONCAT_NULL_YIE LDS_NULL ON
SET ANSI_NULLS ON
SET ANSI_PADDING ON
SET ANSI_WARNINGS ON
COMMIT

GO

CREATE VIEW vw_MyView
WITH SCHEMABINDING
AS
SELECT Col1, Col2 FROM dbo.MyTable WHERECol2 IS NOT NULL

GO
/* --- end --- */

and then added the constraint to the new view

/* --- start --- */
CREATE UNIQUE CLUSTERED INDEX AK_MyTable_Cons traint1 ON
vw_MyView(Col1, Col2)

GO
/* --- end --- */

I thought we were doing fine, 'til we started running some DELETE
stored procedures and got the above error. The error also cited
ARITHABORT as an incorrect setting until we ran this script:

/* --- start --- */
USE master
DECLARE @value int
SELECT @value = value FROM syscurconfigs
WHERE config = 1534
SET @value = @value | 64

EXEC sp_configure 'user options', @value
RECONFIGURE
/* --- end --- */

TIA to anyone kind enough to shed some light on this for me. Is there
something we should have done differently in creating the view and
index? If not, what's the procedure for working through these
settings errors?

I've read through some other threads on this subject, but didn't
really find what I was looking for. Thanks again for any help. Would
be appreciated.

-matt
Jul 20 '05 #1
3 10759
ma*******@hotma il.com (Matt Rink) wrote in message news:<1b******* *************** ****@posting.go ogle.com>...
Getting an "incorrect settings: 'ANSI_NULLS., QUOTED_IDENTIFI ER'."
error after creating a view.

We wanted a composite unique constraint that ignored nulls, so we set
up a view using the following script:

/* --- start --- */
BEGIN TRANSACTION
SET QUOTED_IDENTIFI ER ON
SET ARITHABORT ON
SET NUMERIC_ROUNDAB ORT OFF
SET CONCAT_NULL_YIE LDS_NULL ON
SET ANSI_NULLS ON
SET ANSI_PADDING ON
SET ANSI_WARNINGS ON
COMMIT

GO

CREATE VIEW vw_MyView
WITH SCHEMABINDING
AS
SELECT Col1, Col2 FROM dbo.MyTable WHERECol2 IS NOT NULL

GO
/* --- end --- */

and then added the constraint to the new view

/* --- start --- */
CREATE UNIQUE CLUSTERED INDEX AK_MyTable_Cons traint1 ON
vw_MyView(Col1, Col2)

GO
/* --- end --- */

I thought we were doing fine, 'til we started running some DELETE
stored procedures and got the above error. The error also cited
ARITHABORT as an incorrect setting until we ran this script:

/* --- start --- */
USE master
DECLARE @value int
SELECT @value = value FROM syscurconfigs
WHERE config = 1534
SET @value = @value | 64

EXEC sp_configure 'user options', @value
RECONFIGURE
/* --- end --- */

TIA to anyone kind enough to shed some light on this for me. Is there
something we should have done differently in creating the view and
index? If not, what's the procedure for working through these
settings errors?

I've read through some other threads on this subject, but didn't
really find what I was looking for. Thanks again for any help. Would
be appreciated.

-matt


You need to have those SET options in force not only when you create
the view and indexes, but also when you query it. So your client
application has to use the same settings in its code - OLE DB/ODBC
does this automatically, with the exception of ARITHABORT. In BOL,
Microsoft recommend to set this on at the server level, as you've done
already.

If you still have errors when using the indexed view, it is most
likely that you have some stored procedures which have been created
with ANSI_NULLS and QUOTED_IDENTIFI ER off, not on - those settings are
fixed when the procedure is created. You can recreate the procedures
with the correct SET options, and it should work fine, although of
course that change could affect other code, so you need to test it.

Simon
Jul 20 '05 #2
Hi Matt

As Doug and Simon have said, stored procedures created with certain SET
options enabled will always run with those options, even if you SET them
differently in the batch that calls the procedure. The only two that are
stored this way are "ANSI_NULLS " and "QUOTED_IDENTIF IER". I call these
'sticky' options, because their values 'stick' to the stored procedure.
Since these are the two you are getting messages about, it seems likely that
your procedure was created with the wrong values for these options,.

You can verify whether these options are set with the procedure by using the
OBJECTPROPERTY FUNCTION:

SELECT OBJECTPROPERTY( object_id('proc name'), 'ExecIsAnsiNull sOn' )

SELECT OBJECTPROPERTY( object_id('proc name'), 'ExecIsQuotedId entOn')

If the functions return 1, the property was set, if they return 0, it was
NOT set for the procedure, and you MUST recreate the procedure to use it
with an indexed view.

(If the function returns NULL, it means you typed something wrong. :-) )
--
HTH
----------------
Kalen Delaney
SQL Server MVP
www.SolidQualityLearning.com
"Matt Rink" <ma*******@hotm ail.com> wrote in message
news:1b******** *************** ***@posting.goo gle.com...
Getting an "incorrect settings: 'ANSI_NULLS., QUOTED_IDENTIFI ER'."
error after creating a view.

We wanted a composite unique constraint that ignored nulls, so we set
up a view using the following script:

/* --- start --- */
BEGIN TRANSACTION
SET QUOTED_IDENTIFI ER ON
SET ARITHABORT ON
SET NUMERIC_ROUNDAB ORT OFF
SET CONCAT_NULL_YIE LDS_NULL ON
SET ANSI_NULLS ON
SET ANSI_PADDING ON
SET ANSI_WARNINGS ON
COMMIT

GO

CREATE VIEW vw_MyView
WITH SCHEMABINDING
AS
SELECT Col1, Col2 FROM dbo.MyTable WHERECol2 IS NOT NULL

GO
/* --- end --- */

and then added the constraint to the new view

/* --- start --- */
CREATE UNIQUE CLUSTERED INDEX AK_MyTable_Cons traint1 ON
vw_MyView(Col1, Col2)

GO
/* --- end --- */

I thought we were doing fine, 'til we started running some DELETE
stored procedures and got the above error. The error also cited
ARITHABORT as an incorrect setting until we ran this script:

/* --- start --- */
USE master
DECLARE @value int
SELECT @value = value FROM syscurconfigs
WHERE config = 1534
SET @value = @value | 64

EXEC sp_configure 'user options', @value
RECONFIGURE
/* --- end --- */

TIA to anyone kind enough to shed some light on this for me. Is there
something we should have done differently in creating the view and
index? If not, what's the procedure for working through these
settings errors?

I've read through some other threads on this subject, but didn't
really find what I was looking for. Thanks again for any help. Would
be appreciated.

-matt

Jul 20 '05 #3
Thank you all for your responses. I was able to get past the error by
adding

SET QUOTED_IDENTIFI ER ON
SET ANSI_NULLS ON
GO

to the top of my trouble Stored Procedures in EM. What a maintainance
nightmare! We make all our changes to DB table structure using change
scripts, so that we can execute the batch of scripts on any of our
development/test/production databases. These manual changes needed to
make a new view work definitely monkeys things up. I suppose I'm going
to have to give this some more thought.

I'm surprised this is not a larger issue. Leads me to wonder what I'm
doing wrong...

thanks again,
-matt
"Kalen Delaney" <replies@public _newsgroups.com > wrote in message news:<eI******* *******@TK2MSFT NGP09.phx.gbl>. ..
Hi Matt

As Doug and Simon have said, stored procedures created with certain SET
options enabled will always run with those options, even if you SET them
differently in the batch that calls the procedure. The only two that are
stored this way are "ANSI_NULLS " and "QUOTED_IDENTIF IER". I call these
'sticky' options, because their values 'stick' to the stored procedure.
Since these are the two you are getting messages about, it seems likely that
your procedure was created with the wrong values for these options,.

You can verify whether these options are set with the procedure by using the
OBJECTPROPERTY FUNCTION:

SELECT OBJECTPROPERTY( object_id('proc name'), 'ExecIsAnsiNull sOn' )

SELECT OBJECTPROPERTY( object_id('proc name'), 'ExecIsQuotedId entOn')

If the functions return 1, the property was set, if they return 0, it was
NOT set for the procedure, and you MUST recreate the procedure to use it
with an indexed view.

(If the function returns NULL, it means you typed something wrong. :-) )
--
HTH
----------------
Kalen Delaney
SQL Server MVP
www.SolidQualityLearning.com
"Matt Rink" <ma*******@hotm ail.com> wrote in message
news:1b******** *************** ***@posting.goo gle.com...
Getting an "incorrect settings: 'ANSI_NULLS., QUOTED_IDENTIFI ER'."
error after creating a view.

We wanted a composite unique constraint that ignored nulls, so we set
up a view using the following script:

/* --- start --- */
BEGIN TRANSACTION
SET QUOTED_IDENTIFI ER ON
SET ARITHABORT ON
SET NUMERIC_ROUNDAB ORT OFF
SET CONCAT_NULL_YIE LDS_NULL ON
SET ANSI_NULLS ON
SET ANSI_PADDING ON
SET ANSI_WARNINGS ON
COMMIT

GO

CREATE VIEW vw_MyView
WITH SCHEMABINDING
AS
SELECT Col1, Col2 FROM dbo.MyTable WHERECol2 IS NOT NULL

GO
/* --- end --- */

and then added the constraint to the new view

/* --- start --- */
CREATE UNIQUE CLUSTERED INDEX AK_MyTable_Cons traint1 ON
vw_MyView(Col1, Col2)

GO
/* --- end --- */

I thought we were doing fine, 'til we started running some DELETE
stored procedures and got the above error. The error also cited
ARITHABORT as an incorrect setting until we ran this script:

/* --- start --- */
USE master
DECLARE @value int
SELECT @value = value FROM syscurconfigs
WHERE config = 1534
SET @value = @value | 64

EXEC sp_configure 'user options', @value
RECONFIGURE
/* --- end --- */

TIA to anyone kind enough to shed some light on this for me. Is there
something we should have done differently in creating the view and
index? If not, what's the procedure for working through these
settings errors?

I've read through some other threads on this subject, but didn't
really find what I was looking for. Thanks again for any help. Would
be appreciated.

-matt

Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
6606
by: Steve Foster | last post by:
I have tried many variations (after reviewing other posts) and can not resolve the following issue: RUNNING SQL MAINTENANCE ---------------------------- SET ARITHABORT ON SET CONCAT_NULL_YIELDS_NULL ON SET QUOTED_IDENTIFIER ON SET ANSI_NULLS ON SET ANSI_PADDING ON
3
23498
by: Iqbal | last post by:
Hi, I am getting the following error when I run a stored procedure in which I am inserting/deleting data from a view that selects from a remote table. INSERT failed because the following SET options have incorrect settings: 'ARITHABORT' The first statement in the stored procedure is 'set arithabort on'. I
4
7036
by: teddysnips | last post by:
I am trying to insert a row into a table using a stored procedure and I get the following error if I try this from QA: INSERT failed because the following SET options have incorrect settings: 'ANSI_NULLS., QUOTED_IDENTIFIER'. If I try to run this from Microsoft Access, I get a slightly different error: INSERT failed because the following SET options have incorrect
3
6170
by: teddysnips | last post by:
In the script below is the DDL to create some tables and a UDF. What I'm interested in is the UDF at the end. Specifically, these few lines: --CLOSE OTRate --DEALLOCATE OTRate ELSE -- @NumRecords <= 0 If I uncommment CLOSE and DEALLOCATE and check the syntax I get a
1
1434
by: Calvin Slater | last post by:
It is recommended that the following settings be set for all connections so that the optimizer will perform well on indexed views and stuff. SET QUOTED_IDENTIFIER ON SET ARITHABORT ON SET CONCAT_NULL_YIELDS_NULL ON SET ANSI_NULLS ON SET ANSI_PADDING ON SET ANSI_WARNINGS ON
1
11252
by: Sandesh | last post by:
Hello All, Me saying " has any body come across such error would be underestimating". Well I am getting a very peculiar and unique error "Line 1: Incorrect syntax near 'Actions'." Explaining you the scene is the following Stored Proc.
6
25001
by: ilo | last post by:
When I want to delete a data from a table that this tabl has a trigger and this trigger reached another tables to delete the data in cursor I have this messeage: DELETE failed because the following SET options have incorrect settings: 'QUOTED_IDENTIFIER'. My trigger : CREATE TRIGGER ON . FOR DELETE
1
1671
by: griffel | last post by:
Hello, I am getting a syntax error on a Stored procedure. Server 2003/SQL 2000 SP4 I cant seem to figure what is wrong. Any help would be appreciated. Server: Msg 170, Level 15, State 1, Procedure DocsLAME_MTHPIHUDLINE, Line 13 Line 13: Incorrect syntax near ','. ======================================================================= if exists (select * from dbo.sysobjects where id = object_id(N'.') and OBJECTPROPERTY(id,
1
3362
by: =?Utf-8?B?QmlsIENsaWNr?= | last post by:
I wrote a stored procedure that runs fine when I execute from SQL 2005 Management Studio, and runs ok when I step into it from VS2005. Both return a value of 0, drop, create & populate the table. But when I run it inline in the vb.net code, I get an error: + ex {"Incorrect syntax near 'spCreateRank1'."} System.Data.SqlClient.SqlException No Inner Exception or other useful information I can see.
0
9620
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10104
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10038
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8934
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7460
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6715
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.