indexes with computed columns

  • Ok. I have a table with a computed column. There is an index on this table with only the computed column. When doing an insert in query analyzer, it works. However, if I do the same exact insert in a stored procedure, I get INSERT failed because the following SET options have incorrect settings: 'ANSI_NULLS.'.

    I have this in each of the updates:

    SET ANSI_NULLS ON

    SET ANSI_PADDING ON

    SET ANSI_WARNINGS ON

    SET ARITHABORT ON

    SET CONCAT_NULL_YIELDS_NULL ON

    SET QUOTED_IDENTIFIER ON

    SET NUMERIC_ROUNDABORT OFF

    as specified in this article: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/createdb/cm_8_des_05_8os3.asp

    I can supply code that will generate this if anyone needs it.

    Any ideas????

    -- Joe

  • These things should not be set within the code of the stored procedure. In fact, some of them can't be changed by doing this within the stored procedure.

    They should be set when you create the stored procedure. Called prior to the Create procedure statement.

    Like this:

    SET ANSI_NULLS ON

    SET ANSI_PADDING ON

    SET ANSI_WARNINGS ON

    SET ARITHABORT ON

    SET CONCAT_NULL_YIELDS_NULL ON

    SET QUOTED_IDENTIFIER ON

    SET NUMERIC_ROUNDABORT OFF

    GO

    Create procedure dbo............


    My blog: SQL Soldier[/url]
    SQL Server Best Practices:
    SQL Server Best Practices
    Twitter: @SQLSoldier
    My book: Pro SQL Server 2008 Mirroring[/url]
    Microsoft Certified Master: SQL Server, Data Platform MVP
    Database Engineer at BlueMountain Capital Management[/url]

  • Rawhide, good suggestion, but that didn't do it.

    UPDATE: That fixed the problem partially. The stored procedure now runs in query analyzer successfully, but when I run it from ASP.NET, I get ERROR: INSERT failed because the following SET options have incorrect settings: 'ARITHABORT'.

    " still.

    Any ideas?

    Edited by - jkalin1 on 04/10/2003 07:35:16 AM

  • Any other ideas anyone?

Viewing 4 posts - 1 through 3 (of 3 total)

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