473,624 Members | 2,119 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

INSERT failed because of incorrect SET options

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_IDENTIFI ER'.

If I try to run this from Microsoft Access, I get a slightly different
error:

INSERT failed because the following SET options have incorrect
settings: 'ANSI_NULLS., QUOTED_IDENTIFI ER, ARITHABORT'.

This is what I'm trying to run in QA:

declare @P1 int
set @P1=NULL
exec stpAddNewDistri butionMaster 142, 2, 'INTRODUCTION OF FILTER
ASSEMBLY', 0, 1, @P1 output
select @P1

=============== ============

Here are the relevant definitions:

TABLE:
CREATE TABLE [dbo].[tblDistribution Master] (
[fldDistribution ID] [int] IDENTITY (1, 1) NOT NULL ,
[fldDocumentID] [int] NULL ,
[fldDocumentType] [int] NULL ,
[fldDocumentTitl e] [varchar] (255) COLLATE
SQL_Latin1_Gene ral_CP1_CI_AS NULL ,
[fldDocumentSite ID] [int] NULL ,
[fldActive] [bit] NOT NULL
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[tblDistribution Master] WITH NOCHECK ADD
CONSTRAINT [DF__Temporary__ fldDo__2739D489] DEFAULT (0) FOR
[fldDocumentID],
CONSTRAINT [DF__Temporary__ fldDo__282DF8C2] DEFAULT (0) FOR
[fldDocumentType],
CONSTRAINT [DF__Temporary__ fldDo__29221CFB] DEFAULT (0) FOR
[fldDocumentSite ID],
CONSTRAINT [DF__Temporary__ fldAc__2A164134] DEFAULT (1) FOR
[fldActive],
CONSTRAINT [aaaaatblDistrib utionMaster_PK] PRIMARY KEY NONCLUSTERED
(
[fldDistribution ID]
) WITH FILLFACTOR = 90 ON [PRIMARY]
GO

CREATE INDEX [fldDistribution ID] ON
[dbo].[tblDistribution Master]([fldDistribution ID]) WITH FILLFACTOR =
90 ON [PRIMARY]
GO

CREATE INDEX [fldDocumentID] ON
[dbo].[tblDistribution Master]([fldDocumentID]) WITH FILLFACTOR = 90 ON
[PRIMARY]
GO

CREATE INDEX [fldDocumentSite ID] ON
[dbo].[tblDistribution Master]([fldDocumentSite ID]) WITH FILLFACTOR =
90 ON [PRIMARY]
GO

CREATE INDEX [fldDocumentType] ON
[dbo].[tblDistribution Master]([fldDocumentType]) WITH FILLFACTOR = 90
ON [PRIMARY]
GO

/****** The index created by the following statement is for internal
use only. ******/
/****** It is not a real index but exists as statistics only. ******/
if (@@microsoftver sion > 0x07000000 )
EXEC ('CREATE STATISTICS [hind_37575172_1 A_3A] ON
[dbo].[tblDistribution Master] ([fldDistribution ID], [fldDocumentType])
')
GO

/****** The index created by the following statement is for internal
use only. ******/
/****** It is not a real index but exists as statistics only. ******/
if (@@microsoftver sion > 0x07000000 )
EXEC ('CREATE STATISTICS [hind_37575172_3 A_1A] ON
[dbo].[tblDistribution Master] ([fldDocumentType], [fldDistribution ID])
')
GO

/****** The index created by the following statement is for internal
use only. ******/
/****** It is not a real index but exists as statistics only. ******/
if (@@microsoftver sion > 0x07000000 )
EXEC ('CREATE STATISTICS [hind_37575172_2 A_1A] ON
[dbo].[tblDistribution Master] ([fldDocumentID], [fldDistribution ID]) ')
GO

/****** The index created by the following statement is for internal
use only. ******/
/****** It is not a real index but exists as statistics only. ******/
if (@@microsoftver sion > 0x07000000 )
EXEC ('CREATE STATISTICS [hind_37575172_3 A_2A] ON
[dbo].[tblDistribution Master] ([fldDocumentType], [fldDocumentID]) ')
GO

/****** The index created by the following statement is for internal
use only. ******/
/****** It is not a real index but exists as statistics only. ******/
if (@@microsoftver sion > 0x07000000 )
EXEC ('CREATE STATISTICS [hind_37575172_2 A_3A] ON
[dbo].[tblDistribution Master] ([fldDocumentID], [fldDocumentType]) ')
GO

/****** The index created by the following statement is for internal
use only. ******/
/****** It is not a real index but exists as statistics only. ******/
if (@@microsoftver sion > 0x07000000 )
EXEC ('CREATE STATISTICS [hind_37575172_1 A_2A_3A] ON
[dbo].[tblDistribution Master] ([fldDistribution ID], [fldDocumentID],
[fldDocumentType]) ')
GO

SET QUOTED_IDENTIFI ER ON
GO
SET ANSI_NULLS ON
GO
CREATE TRIGGER "tblDistributio nMaster_UTrig" ON
dbo.tblDistribu tionMaster FOR UPDATE AS
SET NOCOUNT ON
/* * PREVENT UPDATES IF DEPENDENT RECORDS IN 'tblJobs' */
IF UPDATE(fldDistr ibutionID)
BEGIN
IF (SELECT COUNT(*) FROM deleted, tblJobs WHERE
(deleted.fldDis tributionID = tblJobs.fldDist ributionID)) > 0
BEGIN
RAISERROR 44446 'The record can''t be deleted or
changed. Since related records exist in table ''tblJobs'', referential
integrity rules would be violated.'
ROLLBACK TRANSACTION
END
END
GO
SET QUOTED_IDENTIFI ER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFI ER ON
GO
SET ANSI_NULLS ON
GO
CREATE TRIGGER "tblDistributio nMaster_DTrig" ON
dbo.tblDistribu tionMaster FOR DELETE AS
SET NOCOUNT ON
/* * CASCADE DELETES TO 'tblJobs' */
DELETE tblJobs FROM deleted, tblJobs WHERE deleted.fldDist ributionID =
tblJobs.fldDist ributionID
GO
SET QUOTED_IDENTIFI ER OFF
GO
SET ANSI_NULLS ON
GO

=============== ============
SPROC:

CREATE PROCEDURE stpAddNewDistri butionMaster

@DocumentID int,
@DocumentType int,
@Title varchar(255),
@SiteID int,
@Active bit,
@DistributionID int OUTPUT

AS

INSERT INTO tblDistribution Master
(fldDocumentID,
fldDocumentType ,
fldDocumentTitl e,
fldActive,
fldDocumentSite ID)
VALUES
(@DocumentID,
@DocumentType,
@Title,
@Active,
@SiteID)

SET @DistributionID = IDENT_CURRENT(' tblDistribution Master')
GO

=============== ===============

Thanks in advance

Edward

Jul 23 '05 #1
4 7021
That error can come up if you're inserting into a table with an indexed
view on it - could that be the case here? Also, since ANSI_NULLS and
QUOTED_IDENTIFI ER use the settings when the procedure was created, you
could recreate the proc with both those settings ON, to see if that
fixes it.

Simon

Jul 23 '05 #2


Simon Hayes wrote:
That error can come up if you're inserting into a table with an indexed
view on it - could that be the case here? Also, since ANSI_NULLS and
QUOTED_IDENTIFI ER use the settings when the procedure was created, you
could recreate the proc with both those settings ON, to see if that
fixes it.


The only view is this;

CREATE VIEW [dbo].[_hypmv_1] WITH SCHEMABINDING AS SELECT
[dbo].[tbldistribution detail].[fldarchived] as _hypmv_1_col_1,
[dbo].[tbldistribution detail].[fldcompanyid] as _hypmv_1_col_2,
[dbo].[tbldistribution detail].[fldnocdroms] as _hypmv_1_col_3,
[dbo].[tbldistribution detail].[fldnopaper] as _hypmv_1_col_4,
[dbo].[tbldistribution detail].[fldrevisionnumb er] as _hypmv_1_col_5,
[dbo].[tbldistribution detail].[flddocumentnumb er] as _hypmv_1_col_6,
[dbo].[tblcompany].[fldcompanyname] as _hypmv_1_col_7,
[dbo].[tbldistribution master].[flddocumentid] as _hypmv_1_col_8,
[dbo].[tbldistribution master].[flddocumenttype] as _hypmv_1_col_9,
[dbo].[tbldistribution master].[flddistribution id] as _hypmv_1_col_10 ,
count_big(*) as _hypmv_1_col_11 FROM [dbo].[tbldistribution master],
[dbo].[tblcompany], [dbo].[tbldistribution detail] WHERE (
[dbo].[tbldistribution master].[flddistribution id] =
[dbo].[tbldistribution detail].[flddistribution id] ) AND (
[dbo].[tbldistribution detail].[fldcompanyid] =
[dbo].[tblcompany].[fldcompanyid] ) GROUP BY
[dbo].[tbldistribution detail].[fldarchived],
[dbo].[tbldistribution detail].[fldcompanyid],
[dbo].[tbldistribution detail].[fldnocdroms],
[dbo].[tbldistribution detail].[fldnopaper],
[dbo].[tbldistribution detail].[fldrevisionnumb er],
[dbo].[tbldistribution detail].[flddocumentnumb er],
[dbo].[tblcompany].[fldcompanyname],
[dbo].[tbldistribution master].[flddocumentid],
[dbo].[tbldistribution master].[flddocumenttype],
[dbo].[tbldistribution master].[flddistribution id]

which was created by the Index Tuning Wizard. Can I drop this view (I
don't reference it anywhere, and there are no objects that depend on
it)?

Thanks

Edward

Jul 23 '05 #3


Simon Hayes wrote:
That error can come up if you're inserting into a table with an indexed
view on it - could that be the case here? Also, since ANSI_NULLS and
QUOTED_IDENTIFI ER use the settings when the procedure was created, you
could recreate the proc with both those settings ON, to see if that
fixes it.

Simon


I dropped the View and all works fine now.

Thanks

Edward

Jul 23 '05 #4
Yes - I'm not familiar with the Index Tuning Wizard, but WITH
SCHEMABINDING and COUNT_BIG() are both used in indexed views, so it
looks as if this view was intended to support indexing, even if it
isn't right now.

Simon

Jul 23 '05 #5

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

Similar topics

3
10745
by: Matt Rink | last post by:
Getting an "incorrect settings: 'ANSI_NULLS., QUOTED_IDENTIFIER'." 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_IDENTIFIER ON SET ARITHABORT ON
1
6587
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
7
7283
by: Bercin Ates via SQLMonster.com | last post by:
I?m getting an error when I execute a stored procedure which is try to insert a row to a table. The error is: Server: Msg 1934, Level 16, State 1, Procedure SRV_SP_IS_EMRI_SATIRI_EKLE, Line 32 INSERT failed because the following SET options have incorrect settings: 'ANSI_NULLS.'. In my sp, I insert an row to a table. But also I created a view which is select some fields from this table. (Note: Some fields are calculated fields in this...
6
12347
by: pk | last post by:
Sorry for the piece-by-piece nature of this post, I moved it from a dormant group to this one and it was 3 separate posts in the other group. Anyway... I'm trying to bulk insert a text file of 10 columns into a table with 12. How can I specify which columns to insert to? I think format files are what I'm supposed to use, but I can't figure them out. I've also tried using a view, as was suggested on one of the many websites I've...
9
3669
by: anachronic_individual | last post by:
Hi all, Is there a standard library function to insert an array of characters at a particular point in a text stream without overwriting the existing content, such that the following data in appropriately moved further down? From a cursory search of the libc documentation I can't find such a function. Will I have to write it myself? Thanks.
6
24988
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
13
2362
lee123
by: lee123 | last post by:
I have a form I have been working on and now I am almost done with it but there is just one thing I need to finish it that I can figure out. Well I have a questionnaire form with 50 questions and I want to have a msgbox display at the end of the questionnaire "failed" or "passed" when the users have finished the test. On this form I have text boxes with "correct' and "incorrect" and a text box for the total percentage of the correct. This is...
2
5554
by: Arun Srinivasan | last post by:
I need to speed up the inserts through informatica, and I came across insert buf option with db2 packages for import statements and how we can use that option to do the same in java programs. Are there any packages to be bound for informatica powercenter, so that I can rebind them with this option? My informatica person says that Informatica does not bind any packages to the database. Is he missing something. Any one who has worked in...
8
5021
by: Red | last post by:
If auto-format is turned off in VS2008, there is apparently no way to indent a line. Under Tools->Options->Text Editor->C#->Formatting, there are three checkboxes. Unchecking those seems to cause this behavior. I'd simply like to have the tab key insert a tab at the beginning of a line. I believe that there were publlished macros for doing this in earlier VS versions, but I expected this to be 'fixed' in VS2008. Yes, I realize someone...
0
8172
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
8677
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...
0
8620
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...
0
8474
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
7158
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...
0
4079
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...
1
2605
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1784
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1482
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.