Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
506 views
in Technique[技术] by (71.8m points)

sql - Failed because incorrect arithabort setting

I created a unique index (case description should be unique if IsDelete != 1)

CREATE UNIQUE NONCLUSTERED INDEX [UniqueCaseDescription]
ON [tblCases] ([fldCaseDescription] ASC) 
WHERE [IsDeleted] = CAST(0 AS varbinary(1))
WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]

Then when I run the following procedure it throws 'UPDATE failed because the following SET options have incorrect settings: 'ARITHABORT'. Verify that SET options are correct for use with filtered indexes.'

ALTER PROC [usp_DeleteCase] (@fldCaseID UNIQUEIDENTIFIER)
AS
BEGIN   
    UPDATE tblCases
    SET IsDeleted = 1
    WHERE fldCaseID = @fldCaseID

    RETURN 1
END

I tried adding SET ARITHABORT ON before the UPDATE statement, but that didn't do anything.

Any help is greatly appreciated!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

If you use SQL Server try to apply the following settings:

1) Open SQL Server Management Studio. 2) Right click the database name you use and select Properties>Options menu. Then set Arithmetic abort enabled = True from the opened dialog.

Note: I also tried to apply the same settings by using script, but using this method via SSMS is better to apply this setting.

Hope this helps...


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...