UPDATE failed because the following SET options have incorrect settings:

  • I Created a UniqueIndex on a Test Table with Some condition as below and user were getting error msg as below while updating the test table by using the Stored Proc that was generating form Visual Studio.Net Project Solution

    So with out changing the Stored Proc is there any way to get ride of this error msg by creating a Unique Constraint as i was doing below

    Thanks In Advance 🙂

    Index:

    CREATE UNIQUE NONCLUSTERED INDEX UNQ__XYXXXX__ABCD

    ON [dbo].[Test]([ID] ASC) WHERE ID IS NOT NULL WITH (ALLOW_PAGE_LOCKS = ON, ALLOW_ROW_LOCKS = ON, PAD_INDEX = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, STATISTICS_NORECOMPUTE = OFF, ONLINE = OFF, MAXDOP = 0)

    ON [Primary];

    ErrorMsg:

    Msg 1934, Level 16, State 1, Procedure Test_Update, Line 56

    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 filtered indexes and/or query notifications and/or XML data type methods and/or spatial index operations.

  • RamSteve (3/6/2013)


    I Created a UniqueIndex on a Test Table with Some condition as below and user were getting error msg as below while updating the test table by using the Stored Proc that was generating form Visual Studio.Net Project Solution

    So with out changing the Stored Proc is there any way to get ride of this error msg by creating a Unique Constraint as i was doing below

    Thanks In Advance 🙂

    Index:

    CREATE UNIQUE NONCLUSTERED INDEX UNQ__XYXXXX__ABCD

    ON [dbo].[Test]([ID] ASC) WHERE ID IS NOT NULL WITH (ALLOW_PAGE_LOCKS = ON, ALLOW_ROW_LOCKS = ON, PAD_INDEX = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, STATISTICS_NORECOMPUTE = OFF, ONLINE = OFF, MAXDOP = 0)

    ON [Primary];

    ErrorMsg:

    Msg 1934, Level 16, State 1, Procedure Test_Update, Line 56

    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 filtered indexes and/or query notifications and/or XML data type methods and/or spatial index operations.

    Check the stored proc looking for something like:

    SET ANSI_NULLS OFF;

    If you see it, then you will likely need to modify the proc to remove it.

    If the proc does not contain it then chances are the option is being set on the connection before the proc is called, either by the driver the client app is using or explicitly by the application code prior to calling the proc.

    In either case you will need to get it to the point where the update on the table is carried out while ANSI_NULLS is ON.

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply