473,765 Members | 1,978 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 10758
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
6604
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
7035
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
6168
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
11251
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
9404
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
10164
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9959
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
9835
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8833
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
7379
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
6649
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
5423
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3532
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.