473,698 Members | 1,947 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Insert failed & set option error


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 view. To see if calculated fields cause this error , I didnt selec calculated fields in the view, but I?m still getting this insert error.One more note: My indexed field is an identity field also.) I think, index causes this error. But I cant find my error.
Thank you for your help...

To do this view, I execute this code:

drop view SRV_V_GARANTILI _IS_EMRI_SATIRL ARI_T
go

CREATE VIEW dbo.ViewT
with SCHEMABINDING AS
SELECT
S.FieldA,
....S. FieldH
FROM
dbo.TABLE S
WHERE
(S.FieldA = 1) AND (S. FieldB IS NULL) AND (S.FieldH IN (0,1))
go

SET NUMERIC_ROUNDAB ORT OFF
GO
SET ANSI_PADDING,AN SI_WARNINGS,CON CAT_NULL_YIELDS _NULL,ARITHABOR T,QUOTED_IDENTI FIER,ANSI_NULLS ON
GO

create unique clustered index ViewT_IX_FieldA on ViewT (FieldA)
go

*************** *************** ***********
* This message was posted via http://www.sqlmonster.com
*
* Report spam or abuse by clicking the following URL:
* http://www.sqlmonster.com/Uwe/Abuse....4cddba67ade8b6
*************** *************** ***********
Jul 20 '05 #1
7 7285
Bercin Ates via SQLMonster.com (fo***@SQLMonst er.com) writes:
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.
In order to use an indexed view, you must have these SET options:
SET ANSI_PADDING, ANSI_WARNINGS, CONCAT_NULL_YIE LDS_NULL, ARITHABORT,
QUOTED_IDENTIFI ER, ANSI_NULLS ON
GO


(And NUMERIC_ROUNDAB ORT must be OFF)

Of these QUOTED_IDENTIFI ER and ANSI_NULLS are stored with stored procedures,
triggers and user_defined functions. This means that if you do:

SET ANSI_NULLS ON
go
EXEC procedure_saved _with_ansi_null s_off

The procedure runs with ANSI_NULLS OFF.

I don't know why the procedure was saved with ANSI_NULLS off, but one
possibility is that the procedures was loaded with the command-line tool
ISQL that has all the SET commands off by default. If you use ISQL, you
need to include SET ANSI_NULLS ON, QUOTED_IDENTIFI ER ON in your script.

You can also use OSQL, in which case you should specify the -I option,
to have QUOTED_IDENTIFI ER on. (OSQL has the other options on by default.)

--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #2
Thank you for your reply.
I saw that stored procedures always run by using set options as "off".
I'll try to do your methods. Thank you again.

*************** *************** ***********
* A copy of the whole thread can be found at:
* http://www.sqlmonster.com/Uwe/Forum....ql-server/5098
*
* Report spam or abuse by clicking the following URL:
* http://www.sqlmonster.com/Uwe/Abuse....1485f604301423
*************** *************** ***********
Jul 20 '05 #3
Hi, again. Unfortunately I couldn't do it. Because I must insert my new fields by using stored procedure. Even if I added my setting commands inside the sp, it could't do it.
My sp like tihs:

create prosedure...
as
SET ANSI_NULLS ON
SET QUOTED_IDENTIFI ER ON

INSERT INTO SRV_IS_EMRI_SAT IRLARI_DENEME
(
....

As you said before, it use QUOTED_IDENTIFI ER option as "off". How I can set this option as "on" inside the insert proc? Is it not possible?
Thank you again...

Ber?in Ate?

*************** *************** ***********
* A copy of the whole thread can be found at:
* http://www.sqlmonster.com/Uwe/Forum....ql-server/5098
*
* Report spam or abuse by clicking the following URL:
* http://www.sqlmonster.com/Uwe/Abuse....33b79b297aaa4d
*************** *************** ***********
Jul 20 '05 #4
Bercin Ates via SQLMonster.com (fo***@SQLMonst er.com) writes:
Hi, again. Unfortunately I couldn't do it. Because I must insert my new
fields by using stored procedure. Even if I added my setting commands
inside the sp, it could't do it.
My sp like tihs:

create prosedure...
as
SET ANSI_NULLS ON
SET QUOTED_IDENTIFI ER ON

INSERT INTO SRV_IS_EMRI_SAT IRLARI_DENEME
(
...

As you said before, it use QUOTED_IDENTIFI ER option as "off". How I can
set this option as "on" inside the insert proc? Is it not possible?


How could it? If you say:

SET QUOTED_IDENTIFI ER OFF
go
CREATE PROCEDURE tricky AS
SELECT "This is a string" FROM tbl
SET QUOTED_IDENTIFI ER ON
SELECT "This is an identifier" FROM tbl
go

Or even worse:

SET QUOTED_IDENTIFI ER OFF
go
CREATE PROCEDURE tricky AS
SELECT * FROM "This is illegal"
SET QUOTED_IDENTIFI ER ON
SELECT * FROM "This is now a legal table name"
go

Since QUOTED_IDENTIFI ER affects the interpretation of the procedure
text, it must be a static setting.

I don't know why you are setting quoted identifier off, but you will have
to make a choice: have it on, or stop using indexed views. I much recommend
the former.

(So, OK, by using dynamic SQL you can actually circumvent the problem,
but since it will reappear in each place you have the view, that is not
a viable solution.)

--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #5
Ok, this problem was solved now. I have just understood that,I must set this option before creating the procedure.
Thank you very much :)
But now, it is giving ARITHABORT error :(
I'm searching this problem now.Do you have any idea? Thank you again...

*************** *************** ***********
* A copy of the whole thread can be found at:
* http://www.sqlmonster.com/Uwe/Forum....ql-server/5098
*
* Report spam or abuse by clicking the following URL:
* http://www.sqlmonster.com/Uwe/Abuse....22f925624f7fcc
*************** *************** ***********
Jul 20 '05 #6
Bercin Ates via SQLMonster.com (fo***@SQLMonst er.com) writes:
Ok, this problem was solved now. I have just understood that,I must set
this option before creating the procedure. Thank you very much :) But
now, it is giving ARITHABORT error :(
I'm searching this problem now.Do you have any idea? Thank you again...


ARITHABORT is also a setting that has to be on. The problematic issue
with ARITHABORT is that in difference to the other settings is not on
by default when you connect with OLE DB or ODBC.

Therefore you will have to issue a SET ARITHABORT ON when you connect. (For
ARITHABORT there is no setting saved with the procedure.) An alternative
is to use ALTER DATABASE to set ARITHABORT on by default for the database,
or set the configuration option 'user options' to set it by default on
server level. (See Books Online for syntax etc.)

What will not work is to set ARITHABORT inside the procedure. This is
because when you invoke the procedure, SQL Server builds the query plan,
and then finds that there is an access to an indexed view with ARITHABORT
off, because the command SET ARITHABORT ON has not yet been executed. (And
once the command is hit, the procedure will be recompiled, which has a
performance cost.)

--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #7
Thanks a lot:)It's running now.I wish success for all...

_______________ ______
Message posted via http://www.sqlmonster.com
Jul 20 '05 #8

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

Similar topics

0
3736
by: Frank Collins | last post by:
Can anyone point me to some good examples on the web of using values from dynamically created checkboxes on forms in ASP, particularly relating to INSERTING those values into a SQL or Access database? Basically, I have a form on which I have a series of statements, with 3 checkboxes for each statement - YES, NO, MAYBE. This series of statements is being dynamically populated from a query of a table in Access, called "tblQuestions". In...
5
9184
by: dotyet | last post by:
I have been given the daunting task of sql query tuning. I am looking for ways to get started with that. I am on DB2 UDB 8.2 (8.1 with Fixpak 8) on Windows. One point which I could think about starting from is the db2 design advisor. However, whenever I try to execute the db2advis utility I get the following error: C:\db_tuning>db2advis -d DB_TEST1 -user db2admin/db2admin -i query_1.sql Using user id as default schema name. Use -n...
0
6885
by: crypto_solid via AccessMonster.com | last post by:
I have been using a SQL database with a VB5 frontend for about 5 years. Works well. Unfortunately I don't have access to the source code. I was tasked with implementing a "job entry" application that will allow a restricted list of users to enter jobs in the database. We do not want these users to be able to access all the data. I created an application in Access 2002 that performs this function seemingly quite well. However we now...
9
3677
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.
2
4811
by: technocraze | last post by:
Hi guys, I have encountered this error when updating the values to the MS Acess table. Error : Update on linked table failed. ODBC sql server error Timeout expired. MS Acess is my front end and sql server is my backend server. This error occured whenever i step through and when it reaches rs.update it jux hangs down there and thereafter it shwn the aforementioned error. I am using the RecordSet properties to add the values. Can I use...
2
1559
by: DavidOwens | last post by:
<form action="do.php" method="post"> <?php /* create table users (id int, staffid int, region varchar(20), firstname varchar(20), surname varchar(20)); insert into users values(1,1,'region1','John', 'Doe'),(2,2,'region1','Pete', 'Mackay'); create table stores (name varchar(10)); insert into stores values('Name1'),('Name2'),('Name3'),('Name4'),('Na me5'),('Name6'); */ $con = mysql_connect("localhost","root","password");
2
5557
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...
3
3217
by: jonathan184 | last post by:
The code seems to be working fine for some records but I am thinking it is finding some other records with special characters and so on. I am looking for a way to insert the xml string with escaping a bunch of chars This is the message i got DBD::mysql::st execute failed: You have an error in your SQL syntax; check the manual that corresponds to your M ySQL server version for the right syntax to use near 'd to test@email.com...
0
8671
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
8598
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
9152
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
8887
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
8856
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
7709
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
6515
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
5858
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
4613
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.