INSERT Failed Because Of Incorrect SET Options
Jul 23, 2005
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
settings: 'ANSI_NULLS., QUOTED_IDENTIFIER, ARITHABORT'.
This is what I'm trying to run in QA:
declare @P1 int
set @P1=NULL
exec stpAddNewDistributionMaster 142, 2, 'INTRODUCTION OF FILTER
ASSEMBLY', 0, 1, @P1 output
select @P1
===========================
Here are the relevant definitions:
TABLE:
CREATE TABLE [dbo].[tblDistributionMaster] (
[fldDistributionID] [int] IDENTITY (1, 1) NOT NULL ,
[fldDocumentID] [int] NULL ,
[fldDocumentType] [int] NULL ,
[fldDocumentTitle] [varchar] (255) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL ,
[fldDocumentSiteID] [int] NULL ,
[fldActive] [bit] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[tblDistributionMaster] 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
[fldDocumentSiteID],
CONSTRAINT [DF__Temporary__fldAc__2A164134] DEFAULT (1) FOR
[fldActive],
CONSTRAINT [aaaaatblDistributionMaster_PK] PRIMARY KEY NONCLUSTERED
(
[fldDistributionID]
) WITH FILLFACTOR = 90 ON [PRIMARY]
GO
CREATE INDEX [fldDistributionID] ON
[dbo].[tblDistributionMaster]([fldDistributionID]) WITH FILLFACTOR =
90 ON [PRIMARY]
GO
CREATE INDEX [fldDocumentID] ON
[dbo].[tblDistributionMaster]([fldDocumentID]) WITH FILLFACTOR = 90 ON
[PRIMARY]
GO
CREATE INDEX [fldDocumentSiteID] ON
[dbo].[tblDistributionMaster]([fldDocumentSiteID]) WITH FILLFACTOR =
90 ON [PRIMARY]
GO
CREATE INDEX [fldDocumentType] ON
[dbo].[tblDistributionMaster]([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 (@@microsoftversion > 0x07000000 )
EXEC ('CREATE STATISTICS [hind_37575172_1A_3A] ON
[dbo].[tblDistributionMaster] ([fldDistributionID], [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 (@@microsoftversion > 0x07000000 )
EXEC ('CREATE STATISTICS [hind_37575172_3A_1A] ON
[dbo].[tblDistributionMaster] ([fldDocumentType], [fldDistributionID])
')
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 (@@microsoftversion > 0x07000000 )
EXEC ('CREATE STATISTICS [hind_37575172_2A_1A] ON
[dbo].[tblDistributionMaster] ([fldDocumentID], [fldDistributionID]) ')
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 (@@microsoftversion > 0x07000000 )
EXEC ('CREATE STATISTICS [hind_37575172_3A_2A] ON
[dbo].[tblDistributionMaster] ([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 (@@microsoftversion > 0x07000000 )
EXEC ('CREATE STATISTICS [hind_37575172_2A_3A] ON
[dbo].[tblDistributionMaster] ([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 (@@microsoftversion > 0x07000000 )
EXEC ('CREATE STATISTICS [hind_37575172_1A_2A_3A] ON
[dbo].[tblDistributionMaster] ([fldDistributionID], [fldDocumentID],
[fldDocumentType]) ')
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE TRIGGER "tblDistributionMaster_UTrig" ON
dbo.tblDistributionMaster FOR UPDATE AS
SET NOCOUNT ON
/* * PREVENT UPDATES IF DEPENDENT RECORDS IN 'tblJobs' */
IF UPDATE(fldDistributionID)
BEGIN
IF (SELECT COUNT(*) FROM deleted, tblJobs WHERE
(deleted.fldDistributionID = tblJobs.fldDistributionID)) > 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_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE TRIGGER "tblDistributionMaster_DTrig" ON
dbo.tblDistributionMaster FOR DELETE AS
SET NOCOUNT ON
/* * CASCADE DELETES TO 'tblJobs' */
DELETE tblJobs FROM deleted, tblJobs WHERE deleted.fldDistributionID =
tblJobs.fldDistributionID
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
===========================
SPROC:
CREATE PROCEDURE stpAddNewDistributionMaster
@DocumentID int,
@DocumentType int,
@Title varchar(255),
@SiteID int,
@Active bit,
@DistributionID int OUTPUT
AS
INSERT INTO tblDistributionMaster
(fldDocumentID,
fldDocumentType,
fldDocumentTitle,
fldActive,
fldDocumentSiteID)
VALUES
(@DocumentID,
@DocumentType,
@Title,
@Active,
@SiteID)
SET @DistributionID = IDENT_CURRENT('tblDistributionMaster')
GO
==============================
Thanks in advance
Edward
View 4 Replies
ADVERTISEMENT
Oct 23, 2007
Hi
I am currently running the following query from Query Analyser, I am connected to Server_A and inserting records into
Server_B.Database_B.dbo.MyTable from Server_A .Database_A.dbo.TableRef
Insert into Server_B.Database_B.dbo.MyTable(Field1,Field2,Field3)
Select Field1_Ref,
Field2_Ref,
Field3_Ref
from Server_A .Database_A.dbo.TableRef
However Server_B.Database_B.dbo.MyTable is referenced within an Indexed View and whenever I run this query I get the following error:
Msg 1934, Level 16, State 1, Line 1
INSERT failed because the following SET options have incorrect settings: 'ARITHABORT'. Verify that SET options are correct for use with indexed views and/or indexes on computed columns and/or query notifications and/or xml data type methods.
I have tried setting ARITHABORT to ON & OFF within the Query and within the database properties but still recieve the same error.
Does anyone have any ideas on why this would not work?
Thanks
View 19 Replies
View Related
Jul 20, 2005
I have tried many variations (after reviewing other posts) and can notresolve the following issue:RUNNING SQL MAINTENANCE----------------------------SET ARITHABORT ONSET CONCAT_NULL_YIELDS_NULL ONSET QUOTED_IDENTIFIER ONSET ANSI_NULLS ONSET ANSI_PADDING ONSET ANSI_WARNINGS ONSET NUMERIC_ROUNDABORT OFFexec master..xp_sqlmaint '-D SBC -UpdOptiStats 10 -RebldIdx 10'--tried UpdOptiStats and RebldIdx separately with same resultsRECEIVE THE FOLLOWING MESSAGE------------------------------[Microsoft SQL-DMO (ODBC SQLState: 42000)]Error 1934: [Microsoft][ODBC SQL Server Driver][SQL Server]UPDATE STATISTICS failed because the following SET options haveincorrect settings: 'QUOTED_IDENTIFIER, ARITHABORTSERVER SETUP-------------------------------Windows 2000, Service Pack 4SQL Server 2000 Standard Edition, Service Pack 3Any help is greatly appreciated.
View 1 Replies
View Related
Aug 23, 2006
I am getting the following error message:
[-E-19:42] Message: SELECT failed because the following SET options have incorrect settings: 'CONCAT_NULL_YIELDS_NULL, ANSI_WARNINGS, ANSI_PADDING'. Verify that SET options are correct for use with indexed views and/or indexes on computed columns and/or query notifications and/or xml data type methods.
I am using the following set options before the sp is created:
SET ARITHABORT ON
SET CONCAT_NULL_YIELDS_NULL ON
SET QUOTED_IDENTIFIER ON
SET ANSI_NULLS ON
SET ANSI_PADDING ON
SET ANSI_WARNINGS ON
SET NUMERIC_ROUNDABORT OFF
I looked on the internet and most of solutions were related to indexed views or computed columns. But I am neither using any indexed views nor computed columns. Also the same sp is working fine in one environment but giving the above error in another SQL server. I am using SQL Server 2005 with SP1.
Please help me in finding the cause & the resolution for this issue.
View 9 Replies
View Related
Sep 20, 2006
When I want to delete a data from a table that this tabl has a triggerand this trigger reached another tables to delete the data in cursor Ihave this messeage:DELETE failed because the following SET options have incorrectsettings: 'QUOTED_IDENTIFIER'.My trigger :CREATE TRIGGER [TOPBASICIKISSILME] ON [dbo].[TBLDEPOBKTOPBASICIKIS]FOR DELETEASBEGINDECLARE @rows_affected int, @inc bigint , @dblid bigint ,@DEPOBKINCbigintSELECT @rows_affected = @@ROWCOUNTIF @rows_affected = 0RETURN -- No rows changed, exit triggerBEGINDECLARE Miktar CURSOR FORSELECT deleted.DBLID,deleted.TOPBASICIKISINC , deleted.DEPOBKINCFROM deletedOPEN MiktarFETCH NEXT FROM Miktar INTO @dblid,@inc,@DEPOBKINCWHILE @@fetch_status = 0BEGINSET QUOTED_IDENTIFIER ONDELETE FROM TBLDEPOBKMIKTAR WHERE DEPOBKINC=@DEPOBKINCAND OWNERINC = @inc AND ISLEMID=2 AND HAREKETID=19 AND BIRIM=1SET QUOTED_IDENTIFIER OFFPRINT @DEPOBKINCFETCH NEXT FROM Miktar INTO @dblid,@inc,@DEPOBKINCENDCLOSE MiktarDEALLOCATE MiktarENDEND
View 6 Replies
View Related
Oct 1, 2007
Hi, i have problem as subject says.
Db has table with 3 columns, ID, Key and Val. ID is primary key, Key has unique index and Val simple holds value in text format.
I have created DAL layer using .netTiers and CodeSmith. Generated procedures.sql has before every procedure set ANSI_NULLS to OFF.
When i read rows from table i print them on screen. When user changes value, that should also be updated in database.
When i select entity, its value is changed.
Here is code snipper.
Code Blockentity.Key = key;
entity.Value = value;
TransactionManager transactionManager = DataRepository.Provider.CreateTransaction();
try
{
transactionManager.BeginTransaction();
retVal = DataRepository.TestTableProvider.Update(entity);
transactionManager.Commit();
}
catch
{
transactionManager.Rollback();
throw;
}
I got an exception with message below:
UPDATE failed because the following SET options have incorrect settings: 'ANSI_NULLS'. Verify that SET options are correct for use with indexed views and/or indexes on computed columns and/or query notifications and/or xml data type methods.
Also, class which hold previous code snipper supports caching, by using some kind of SqlCacheManager, which is above SqlCacheDependecy class. Database service broker is started by
Code Block
ALTER DATABASE <DB_NAME> SET ENABLE_BROKER
Server is SqlExpress 2005.
Application is in ASP.NET 2.0.
I also noticed next.
On first run, previous code passes without errors. On second run, update error appears.
This is log from sql server.
Code BlockQuery notification delivery could not send message on dialog '{822C7891-736E-DC11-836B-005056C00008}.'. Delivery failed for notification '<qn:QueryNotification xmlns:qn="http://schemas.microsoft.com/SQL/Notifications/QueryNotificationhttp://schemas.microsoft.com/SQL/Notifications/QueryNotification">http://schemas.microsoft.com/SQL/Notifications/QueryNotification</A< A>>" id="1" type="change" source="database" info="restart" database_id="13" sid="0xE7C0751C9F7F6C4D9423096BBCC7FB69"><qn:Message>edd3e2dd-11ed-4d92-a0f4-5c674a90aecf;8b2095663cc6a9c297120e4c94d488555e97e54d</qn:Message></qn:QueryNotification>' because of the following error in service broker: 'The conversation handle "822C7891-736E-DC11-836B-005056C00008" is not found.'
Need fast answer.
Thanks in advance.
View 5 Replies
View Related
Jul 20, 2005
Hi,I am getting the following error when I run a stored procedure inwhich I am inserting/deleting data from a view that selects from aremote table.INSERT failed because the following SET options have incorrectsettings: 'ARITHABORT'The first statement in the stored procedure is 'set arithabort on'. Ialso ran 'set arithabort on' before creating the view.I read many articles ragarding the setting of arithabort. I set it forthe connection, for the database (alter database) and above all forthe server (sp_configure) but could not get around the above error.However, when I had made the setting using "sp_configure 'useroptions', 64" I was able to run the stored procedure successfully acouple of times. But, later when I had resest 'user options' to 0 andthen back to 64 just to reproduce the earlier error and confirm thatthe error does not come with the 'user options' to 64 setting I wasgetting the same error.Is there any way by which I can overcome the problem?Thanks,Iqbal
View 3 Replies
View Related
Sep 6, 2000
Hi,
I want to import in a table a file like this one, with a comma separator:
France, 1 , 1
"Congo,Démocratique", 1,2
Is there any options for Bulk Insert like this in Sybase :
LOAD [ INTO ] TABLE [ owner ].table-name [( column-name , ... )]
FROM 'filename -string '
[ load-option ... ]
Parameters
load-option :
CHECK CONSTRAINTS { ON | OFF }
| DEFAULTS { ON | OFF }
| DELIMITED BY string
| ESCAPE CHARACTER character
| ESCAPES { ON | OFF }
| FORMAT ASCII
| QUOTES { ON | OFF }
| STRIP { ON | OFF }
| WITH CHECKPOINT { ON | OFF }
or should we change the pre processing of our log files ??
Thanks to your answers
Axel
View 2 Replies
View Related
Jul 4, 2007
Generally bulk insert is used to insert bulk data from flat files or csv files into database tables. Thats good. But while inserting the data into table, if the schema of the table changes (say a column is added or removed) then are there any options for inserting the same data, with some changes, into the database table...
My work is to take backup of the tables and insert them to a new database with some changes in schema like adding a column or removing a column.
View 5 Replies
View Related
Sep 3, 2007
Hi
I get the following error when running a report in report builder using the Adventureworks sample model:
Semantic query execution failed. Incorrect syntax near 'NULLAND'.----------------------------Query execution failed for data set 'dataSet'.----------------------------An error has occurred during report processing.
Here is how to replicate the error:
Create a table report using the Adventure Works model.
Select Product entity, add Product Category and #Products to the table.
Edit formula for #Products to "COUNT(Products)" and add a filter on Products for "Discontinued Date is empty". (I want a count of products that have not been discontinued).
If you run the report now, it willl work as expected.
Add a report filter for "Product.Color is empty" (I only want to see products that don't have a color)
Run the report to get the above error.
While the above is a contrived example, I am getting the same error on a data model that I am developing for a customer.
Am I missing something, or is this a bug in Report Builder?
Thanks
View 2 Replies
View Related
Mar 23, 2008
I can select the tables and fields, but when I click on Advanced the Check Box to Create the Commands is not available. they are dimmed out.
Why is this happening, is it a setting that I have missed. Any help is appreciated.
View 1 Replies
View Related
Sep 23, 2013
I just upsized my access backend and a few of my tables did not import data. I am trying to do a bulk insert and this is the code I am using:
"BULK INSERT [dbo].[invoices]"
Select ('VendorName, Invoice_Number, DueDate,Type_of_Invoice, Select_field, Invoice_Status, tday, discount, file_as, Invoice_amount, Date_Paid, check_number, apply_discount, amountpaid')
FROM 'A:Invoices2.csv'
;WITH
(
FIELDTERMINATOR = ',')',
ROWTERMINATOR = "n")',
GO
When I click on the execute button I get this message:
Msg 102, Level 15, State 1, Line 3
Incorrect syntax near 'A:Invoices2.csv'.
View 3 Replies
View Related
Feb 18, 2015
I create table with automatically generate the next ID.
create table #people
(id integer identity primary key not null,
name varchar(20),
surname varchar(30),
number Char(11)
);
and next I would like to add many lines
insert into #people (name, surname, number)
VALUES
('Anne', 'Ferguson', '123456789'),
('Eve', 'Atkinson', '234567891'),
('John', 'Smith','345678912');
and I've got:
Msg 102, Level 15, State 1, Line 3
Incorrect syntax near ','.
This is something wrong with the row ('Anne...
I use sql MS server 2008
View 1 Replies
View Related
Jul 11, 2015
SQL Version:Â SQL2014
PROBLEM: The SQL insert trigger code below is returning incorrect results. In some cases the results returned are from entirely different fields than those specified as the source field in the SET statement. For instance the value returne for the Price_BeforeAdj field does not = 20000000? It returns a NULL. See code below.
OFFENDING CODE:
ALTER TRIGGER [dbo].[xcti_WIPAdjustments_I]
  ON [dbo].[budxcWIPAdjustments]
AFTER INSERT AS
BEGIN
 SET NOCOUNT ON;
  UPDATE budxcWIPAdjustments
[Code] ....
View 11 Replies
View Related
Apr 8, 2005
Hi!I am trying to insert into a sql server 2000 enterprise edition database from a .net application. but I keep getting the error server doesnot exist or access denied. I can connect to the server from query analyzer and sql manager. The database is running on windows 2003. The only thing I don't see is the ASPNET sys account not on the login database. I don't know how to add that.
Here is the connection string that I have always used and worked before.
Network Library=DBMSSOCN; Data Source=DEVELOPERS,1433; Initial Catalog=CMLTODB;User ID=sa;Password=password
Thanks,
View 3 Replies
View Related
Aug 4, 2005
HiI'm trying to port some data from one database table to anotherdatabase table on the same server.This is the query I am using:----->INSERT into newdatabase.dbo.contactevents (EventTypeID, UserID,ContactID, DateEntered, EventDate, Description)select '20','1', ContactID, '1/1/2005 00:00', '1/1/2005 00:00',ISNULL(Notes,'')from olddatabase.dbo.contacteventsWHERE Exists (SELECT ContactID FROM newdatabase.dbo.contacts)<-------This is the error I'm getting:----->INSERT statement conflicted with COLUMN FOREIGN KEY constraint'FK_ContactEvents_Contacts'. The conflict occurred in database'newdatabase', table 'Contacts', column 'ContactID'.The statement has been terminated.<-------There is a relationship between the contacts table (Primary keyContactID) and the contactsevent (foreign key ContactID) table. I guessthe error being flagged up here is that some contacts don't exist inthe new database, therefore referential intergretory won't allow itbeing copied. I thought I could get around this using:"WHERE Exists (SELECT ContactID FROM newdatabase.dbo.contacts)"Note I've also tried:"WHERE Exists (SELECT * FROM newdatabase.dbo.contacts)"What am I doing wrong?Many Thanks!Alex
View 6 Replies
View Related
Feb 19, 2008
Hi i am trying to bulk insert records from flat file to sql table, but i am getting the following error
Error: 0xC002F304 at Bulk Insert Task, Bulk Insert Task: An error occurred with the following error message: "Cannot fetch a row from OLE DB provider "BULK" for linked server "(null)".The OLE DB provider "BULK" for linked server "(null)" reported an error. The provider did not give any information about the error.Cannot bulk load because the maximum number of errors (10) was exceeded.".
Task failed: Bulk Insert Task
can any one guide me regarding this.
View 6 Replies
View Related
Dec 6, 2004
Hey guys..
Trying to insert a row via Enterprise Manager I get "object does not exist" error.. However it works on another server?!?
The table name is aa.aabc .. So i know what the problem is.. it thinks that aa is the owner.. I can insert using query analyzer by using the following syntax: insert into [aa.aabc] ... but it fails using: insert into aa.abc .. for obvious reasons..
I'm guessing it has something to do with the differences in the server config between the 2 servers as to why one server you can insert via enterprise manager and the other you cant..
The collation is different as the ANSI warning and padding in the connection info..
Can anyone else help me fix this problem, so that I can insert using enterprise manager?
Cheers
View 2 Replies
View Related
Jul 20, 2005
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 32INSERT 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_SATIRLARI_TgoCREATE VIEW dbo.ViewTwith SCHEMABINDING ASSELECTS.FieldA,....S. FieldHFROMdbo.TABLE SWHERE(S.FieldA = 1) AND (S. FieldB IS NULL) AND (S.FieldH IN (0,1))goSET NUMERIC_ROUNDABORT OFFGOSET ANSI_PADDING,ANSI_WARNINGS,CONCAT_NULL_YIELDS_NULL ,ARITHABORT,QUOTED_IDENTIFIER,ANSI_NULLS ONGOcreate 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...d4cddba67ade8b6*****************************************
View 7 Replies
View Related
May 1, 2008
Hi
Wrote this snipet of code to use Insert Into. I have an ODBC connection to Oracle with the Tables linked. I can edit, add write querries and do everything I need to do except do an Insert Into. So I am thinking it is my code and seeking guidance.
I select add data from a button on the form. It then calls the code below. I know it is making it up to the db.execute statement and failing at that point. Funny thing is I only get the error "ODBC Call Failed" and no other snippets of information. On top of that I can not relink to the tables as they are now unaccessible and I have to completely close down the program and restart. Any help/assistance will be greatly appreciated. Thank you, Here is the code:
Code Start:
Private Sub btn_add_rca_record_Click()
On Error GoTo Err_btn_add_rca_record_Click
Dim db As Database
Dim rsCust As Recordset
Dim strSQL As String
Dim nbrRcaTicketId As Long
Set db = CurrentDb
nbrRcaTicketId = (100 + (DCount("*", "RCA_TABLE")))
strSQL = "Select * from RCA_TABLE "
Set rsCust = db.OpenRecordset(strSQL, DB_OPEN_DYNASET)
MsgBox "start of sql string"
strSQL = "INSERT INTO RCA_TABLE "
strSQL = strSQL & "( RCA_TICKET_ID, REPORT_AUTHOR_STAFF_ID, REPORT_START_DATE, REPORT_CLOSE_DATE, REPORTS_PARTICIPANTS_REVIEW, "
strSQL = strSQL & " INCIDENT_TICKET_NUMBER,INCIDENT_SEVERITY_LEVEL,INCIDENT_START_DATE_EVENT,INCIDENT_START_TIME_EVENT,INCIDENT_TIME_SERVICE_DOWN,INCIDENT_END_DATE_EVENT,INCIDENT_TIME_SERVICE_UP,INCIDENT_TIME_UP_TO_CUSTOMER,INCIDENT_OUTAGE_DURATION,INCIDENT_DETECTION_METHOD,INCIDENT_DISCOVERED_BY,INCIDENT_RESP_GROUP,INCIDENT_OWNER,INCIDENT_PRODUCTS_AFFECTED,INCIDENT_CUSTOMERS_AFFECTED, "
strSQL = strSQL & " CHANGE_EXTENT_AFFECTED, CHANGE_CAUSED_BY_CHANGE, CHANGE_RFC_NUMBER, CHANGE_BACK_OUT_INITIATED, CHANGE_RFC_FOLLOWUP_NUMBER, "
strSQL = strSQL & " PROBLEM_OWNER, PROBLEM_CATEGORY, PROBLEM_STATUS, PROBLEM_IMPACT, PROBLEM_URGENCY, "
strSQL = strSQL & " INCIDENT_SECONDARY_TICKET_NBR,INCIDENT_EVENT_DESCRIPTION,PROBLEM_DETAILS,DISCUSSION_DONE_RIGHT,DISCUSSION_PROCEDURAL_ISSUE,DISCUSSION_BETTER_NEXT_TIME,DISCUSSION_PREVENT_PROBLEM,PROBLEM_WWORKAROUND )"
strSQL = strSQL & " ALT_TICKET1,ALT_SYSTEM1,ALT_STATUS1,ALT_DATE_OPENED1,ALT_DATE_CLOSED1,ALT_SEVERITY_LEVEL1,ALT_PRIMARYOWNER1,ALT_LINK1,ALT_TICKET2, "
strSQL = strSQL & " ALT_SYSTEM2,ALT_STATUS2,ALT_DATE_OPENED2,ALT_DATE_CLOSED2,ALT_SEVERITY_LEVEL2,ALT_PRIMARYOWNER2,ALT_LINK2 )"
strSQL = strSQL & " values ('"
strSQL = strSQL & nbrRcaTicketId & "','"
strSQL = strSQL & Me!nbr_REPORT_AUTHOR_STAFF_ID & "','"
strSQL = strSQL & Me!dte_Report_Start_Date & "','"
strSQL = strSQL & Me!dte_Report_Close_date & "','"
strSQL = strSQL & Me!str_Report_Paticipants_In_Review & "','"
strSQL = strSQL & Me!nbr_Incident_Ticket_Number & "','"
strSQL = strSQL & Me!nbr_Incident_Severity_Level & "','"
strSQL = strSQL & Me!dte_Incident_Start_date & "','"
strSQL = strSQL & Me!dte_Incident_Start_Time_Event & "','"
strSQL = strSQL & Me!dte_Incident_Time_Service_Down & "','"
strSQL = strSQL & Me!dte_Incident_End_date & "','"
strSQL = strSQL & Me!dte_Incident_Time_Service_Up & "','"
strSQL = strSQL & Me!dte_Incident_Time_Up_To_Customer & "','"
strSQL = strSQL & Me!nbr_Incident_Outage_Duration & "','"
strSQL = strSQL & Me!nbr_Incident_Detection_Method & "','"
strSQL = strSQL & Me!nbr_Incident_Discovered_By & "','"
strSQL = strSQL & Me!nbr_Incident_Resp_Group & "','"
strSQL = strSQL & Me!str_Incident_Owner & "','"
strSQL = strSQL & Me!str_Incident_Products_Affected & "','"
strSQL = strSQL & Me!str_Incident_Customers_Affected & "','"
strSQL = strSQL & Me!str_Change_Extent_Affected & "','"
strSQL = strSQL & Me!str_Change_Caused_by_Change & "','"
strSQL = strSQL & Me!nbr_Change_RFC_Number & "','"
strSQL = strSQL & Me!str_Change_Back_out_Initiated & "','"
strSQL = strSQL & Me!nbr_Change_RFC_Followup_Number & "','"
strSQL = strSQL & Me!nbr_Problem_Owner & "','"
strSQL = strSQL & Me!nbr_Problem_Category & "','"
strSQL = strSQL & Me!nbr_Problem_Status & "','"
strSQL = strSQL & Me!nbr_Problem_Impact & "','"
strSQL = strSQL & Me!nbr_Problem_Urgency & "','"
strSQL = strSQL & Me!nbr_Incident_Secondary_Ticket_Numbers & "','"
strSQL = strSQL & Me!str_Incident_Event_Description & "','"
strSQL = strSQL & Me!str_Problem_Details & "','"
strSQL = strSQL & Me!str_Discussion_Done_Right & "','"
strSQL = strSQL & Me!str_Discussion_Procedural_Issue & "','"
strSQL = strSQL & Me!str_Discussion_Better_Next_Time & "','"
strSQL = strSQL & Me!str_Discussion_Prevent_Problem & "','"
strSQL = strSQL & Me!str_Problem_WWorkaround & "','"
strSQL = strSQL & Me!nbr_ALT_TICKET1 & "','"
strSQL = strSQL & Me!nbr_ALT_SYSTEM1 & "','"
strSQL = strSQL & Me!nbr_ALT_STATUS1 & "','"
strSQL = strSQL & Me!dte_ALT_DATE_OPENED1 & "','"
strSQL = strSQL & Me!dte_ALT_DATE_CLOSED1 & "','"
strSQL = strSQL & Me!nbr_ALT_SEVERITY_LEVEL1 & "','"
strSQL = strSQL & Me!nbr_ALT_PRIMARYOWNER1 & "','"
strSQL = strSQL & Me!str_ALT_LINK1 & "','"
strSQL = strSQL & Me!nbr_ALT_TICKET2 & "','"
strSQL = strSQL & Me!nbr_ALT_SYSTEM2 & "','"
strSQL = strSQL & Me!nbr_ALT_STATUS2 & "','"
strSQL = strSQL & Me!dte_ALT_DATE_OPENED2 & "','"
strSQL = strSQL & Me!dte_ALT_DATE_CLOSED2 & "','"
strSQL = strSQL & Me!nbr_ALT_SEVERITY_LEVEL2 & "','"
strSQL = strSQL & Me!nbr_ALT_PRIMARYOWNER2 & "','"
strSQL = strSQL & Me!str_ALT_LINK2 & "');"
db.Execute strSQL
MsgBox nbrRcaTicketId & " has been added to the Customer table."
Call ClearControls
rsCust.Close
db.Close
Exit_btn_add_rca_record_Click:
Exit Sub
Err_btn_add_rca_record_Click:
MsgBox Error$
rsCust.Close
db.Close
GoTo Exit_btn_add_rca_record_Click:
End Sub
Code End:
View 1 Replies
View Related
May 28, 2015
The reason why cust_id started at #4 and not #1 is because I failed to insert property three times in a row for having "Tatoine" instead of "WI" or a state less than 5chars nchar(5) correct? Then when I did a valid statement, the row was created at the starting number of four. I imagine this prevents users from having duplicate cust_ids. This however is also where rollback and similar commands could be handy correct or is there something more obvious I'm missing on a failed "insert into" to not increment the cust_id. The three rows 1,2 and 3 do not exist I believe and are not null. Â Having null values would of contradicted the table where two columns "not null" are a requirement.
CREATE TABLE customersnew
(
cust_idINTNOT NULL IDENTITY(1,1),
cust_nameNCHAR(50)NOT NULL,
cust_addressNCHAR(50)NULL ,
cust_cityNCHAR(50)NULL ,
cust_stateNCHAR(5)NULL ,
[code]...
View 2 Replies
View Related
Oct 12, 2000
Good afternoon one and all,
I have the folowing problem that I could use some help with :
I have an SQL server database acting as a back end to an access dbase. The SQL srv table contains over 32 million records and I am trying to use an append query (in access) to import a further 2 million records to the SQLSRV table. The append query fails with the message 'Insert on table bcdsales failed' followed by an ODBC timeout error message. I can append one record fine but a mass import fails.
Unfortunately i can't use SQL srv to do the import (internal policy says we must stick with access front end for now).
Any and all ideas welcomed.
TIA for your time and attention
Gurmi
View 2 Replies
View Related
Oct 25, 2004
Auditors want us to track when Insert, Update and Delete failures occur. Is this possible in SQL 2000?
They also want us to track schema changes. Is this possible?
Thanks, Dave
View 5 Replies
View Related
Jun 17, 2014
One of my database transaction log backup jobs failed this morning, although the log backup was still taken, the job reported failure. The job has run successfully a number of times since. The job reported a primary key violation error on the msdb.dbo.backupmediaset table. The full error message was
Violation of PRIMARY KEY constraint 'PK__backupme__DAC69E4D599F1693'. Cannot insert duplicate key in object 'dbo.backupmediaset'. The duplicate key value is (401862).
Msg 3009, Level 16, State 1, Server myservername, Line 1
Could not insert a backup or restore history/detail record in the msdb database. This may indicate a problem with the msdb database. The backup/restore operation was still successful.
After investigating the backupset and backupmediaset tables in msdb I can see that value used for the failed insert was used previously for the last database log backup in the previous log backup run. The failure was reported for the first database log backup attempted. The SQL Log shows an entry for the log being backed up successfully.
I have checked the identify value in the backupmediaset table using DBCC CHECKIDENT and all looks OK.
DBCC CHECKIDENT ('backupmediaset',NORESEED)
Is there anything else I need to check?
View 6 Replies
View Related
Feb 1, 2008
FYI: I'm using SQL2005 on a windows 2003 server.
So, I've written an Instead of Trigger to update a foreign key field based on information in another field of the same record.
To add some error handling to the process I updated the Trigger to insert any records that don't have legitimate foreign keys into a second table.
This process works great when I test it by just adding a record using the table view in the SQL Management Studio or through a query run in the query browser.
However, when a record is added via an ODBC connection I get foreign key constraint errors and records are not added to the second table. If the foreign key is legit the record is added and the part of trigger that updates that keyed field executes just fine.
Is anyone aware of this issue? Is there a way around it?
I found the following MSKB article but I'm not sure if it applies to my situation:
http://support.microsoft.com/kb/304096
Here's my current code, if that track the problem in anyway:
Code:
ALTER TRIGGER UpdateTicketID
ON Email
Instead of INSERT
AS
IF ((Select charindex('{', [subject]) FROM Inserted) = 0)
BEGIN
INSERT INTO
BadEmail ([Subject], Sender, Body, EntryID, LastModificationTime, AttachmentLInk, SendTo, Cc, ContactID)
Select
[Subject], Sender, Body, EntryID, LastModificationTime, AttachmentLink, SendTo, Cc, ContactID
From
Inserted
END
ELSE IF ((Select substring([subject], charindex('{', [subject])+1, (charindex('}', [subject]) - charindex('{', [subject]))-1) From Inserted) NOT In (Select TicketID From Ticket))
BEGIN
INSERT INTO
BadEmail ([Subject], Sender, Body, EntryID, LastModificationTime, AttachmentLInk, SendTo, Cc, ContactID)
Select
[Subject], Sender, Body, EntryID, LastModificationTime, AttachmentLink, SendTo, Cc, ContactID
From
Inserted
END
ELSE
BEGIN
INSERT INTO
Email ([Subject], Sender, Body, ticketID, EntryID, LastModificationTime, AttachmentLink, SendTo, Cc, ContactID)
Select
[Subject]
, Sender
, Body
, substring([subject], charindex('{', [subject])+1, (charindex('}', [subject]) - charindex('{', [subject]))-1)
, EntryID
, LastModificationTime
, AttachmentLink
, SendTo
, Cc
, ContactID
From
Inserted
END
GO
Thank very much for any help.
-Will
View 1 Replies
View Related
Dec 28, 2007
Hi,I'm new at asp .net and am having a problem. On a linkbutton click event, I want to insert into my db a row of data which includes two parameters. Param1 is the id of the logged in user, and Param2 is <%#DataBinder.Eval(Container.DataItem, 'UserId')%> which is the username of a user given through a datalist.When I execute the query: "insert into aspnet_friendship (userId, buddyId) values (@Param1, @Param2)"I get the error: Conversion failed when converting from a character string to uniqueidentifier.I am trying to insert these into my table aspnet_friendship into the columns userId and buddyId which are both uniqueidentifier fields. I tested the query using the same values (@Param1, @Param1) and (@Param2, @Param2) and found out that the problem is with Param2 because when I use Param1 the insert works perfectly. The value passed by Param2 is supposed to be the id of a user which I get from the datalist which selects * from aspnet_Users, so that <%#DataBinder.Eval(Container.DataItem, 'UserId')%> should also be an Id like Param1 is. Since both params are in the form of .toString(), I don't understand why one works but the other doesn't.As you can see in the code below, both of these parameters are dimmed as strings, so I don't understand why Param2 doesn't work. Can anyone please help? Protected Sub LinkButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Dim MyConnection As SqlConnection MyConnection = New SqlConnection("Data Source=.SQLEXPRESS;AttachDbFilename=|DataDirectory|ASPNETDB.MDF;Integrated Security=True;User Instance=True") Dim MyCommand2 As SqlCommand Dim CurrentUser As String CurrentUser = Membership.GetUser.ProviderUserKey.ToString() Dim add As String add = "<%#DataBinder.Eval(Container.DataItem, 'UserId')%>".ToString() Session("username") = User.Identity.Name Dim InsertCmd As String = "insert into aspnet_friendship (userId, buddyId) values (@Param1, @Param2)" MyCommand2 = New SqlCommand(InsertCmd, MyConnection) MyCommand2.Parameters.AddWithValue("@Param1", CurrentUser) MyCommand2.Parameters.AddWithValue("@Param2", add) MyCommand2.Connection.Open() MyCommand2.ExecuteNonQuery() MyCommand2.Connection.Close() End Sub Thank you.
View 3 Replies
View Related
Mar 23, 2006
I get this error when trying to alter a stored procedure that has an insert statement referencing a new linked server I created:
INSERT INTO [servername].databasename.dbo.DirectReport
...
Msg 18456, Level 14, State 1, Procedure Get_Direct_Pay_Move_Data, Line 17
Login failed for user 'NT AUTHORITYANONYMOUS LOGON'.
I added Administrators and my logon to the permissions of my linked server but still get this error when it tries to save my stored proc...the one which has that insert.
View 4 Replies
View Related
May 27, 2008
This is the error it gives me for my code and then it calls out line 102. Line 102 is my buildDD(sql, ddlPernames) When I comment out this line the error goes away, but what I don't get is this is the same way I build all of my dropdown boxes and they all work but this one. Could it not like something in my sql select statement. thanksPrivate Sub DDLUIC_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DDLUIC.SelectedIndexChanged
Dim taskforceID As Byte = ddlTaskForce.SelectedValueDim uic As String = DDLUIC.SelectedValue
sql = "select sidstrNAME_IND from CMS.dbo.tblSIDPERS where sidstrSSN_SM in (Select Case u.strSSN from tblAssignedPersonnel as u " _
& "where u.bitPresent = 1 and u.intUICID in (select intUICID from tblUIC where intTaskForceID = " & taskforceID & " and strUIC = '" & uic & "'))"ddlPerNames.Items.Add(New ListItem("", "0"))
buildDD(sql, ddlPerNames)
End Sub
View 2 Replies
View Related
Jul 16, 2003
Very often, when I generate SQL scripts for a table, I forget to go to Option tab to click the pk, default, index boxes. Is there a way to permernatly set the whole sql server generate sql scripts options ONCE?
thanks
David
View 2 Replies
View Related
Mar 10, 2006
HiI have created a Sql Script through Enterprise Manager for Drop acolumn. By default its creating lot of 'SET' commands. I doubt allthese SET options are required or not. Pls comment on this issueBEGIN TRANSACTIONSET QUOTED_IDENTIFIER ONSET TRANSACTION ISOLATION LEVEL SERIALIZABLESET ARITHABORT ONSET NUMERIC_ROUNDABORT OFFSET CONCAT_NULL_YIELDS_NULL ONSET ANSI_NULLS ONSET ANSI_PADDING ONSET ANSI_WARNINGS ONCOMMITBEGIN TRANSACTIONALTER TABLE EmployeeDROP COLUMN OrderDetails_IDGOCOMMITDil
View 2 Replies
View Related
Jan 18, 2008
Hi ,
I could do with a couple of pointers to the best options to acheive my goal, I'm pretty close with the way I've done it, but I feel there is a more elegant solution out their so your help would be most appreciated.
The problem is finding the best way of moving some SQL Server 2000 changed data into sql server 2005. We are only interested in some tables in 2000 (and sometimes just subsets of those). Because there are quite a few tables and the we want to set up a schedule to run periodically, we chose SSIS. The main reason for this is to utilise a for each loop that pulls each tables name from a one column staging table of table names. (that way we can do more or less comparisons by simply adding and removing from the staging table) Also in this loop, using the table name as a variable, we run an exec sql task along the lines of 'SELECT * from varTable EXCEPT SELECT * from varTable_tracker' which gives us the difference beteween the two tables (where the tracker table is a copy of the data table which is sychronised at the end of the job run). So far so good. Now the tricky bit, EXCEPT only works under 2005, the tables are in 2000 so we ended up having a linked server in 2005 back to the 2000 table. Is there a way of acheiving the same result without involving the linked server - or is there a task (script?) we can run to verify the linked server is up before we excecute the job -we already run checks on Connection Managers to see if they are up but never tried linked servers? Lastly, will performance be an issue
Thanks
View 5 Replies
View Related
May 4, 2002
anyone know about the undocument options of DBCC?
which options are undomented?
i.e.
log
There are only a few options which are documented in SQL Online Books
thank in advance
View 1 Replies
View Related
Dec 13, 1999
Is it necessary to reinstall SqlSvr 6.5 in order to chance
from 'per server' to 'per seat' licensing ?
View 1 Replies
View Related