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