Heterogeneous queries require the ANSI_NULLS and ANSI_WARNINGS options to be set for the connection. This ensures consistent query semantics

前端 未结 3 644
半阙折子戏
半阙折子戏 2020-12-20 19:39

I have checked over the whole web and couldn\'t find a solution that seems to work for me..

I have recreated my stored procedure, making sure to have these lines as

相关标签:
3条回答
  • 2020-12-20 19:48

    This is an example that works... Try it like this

    create procedure dbo.access_update @O_SQL_Error_State int = NULL     output
    
    as
    
    set ANSI_NULLS ON 
    
    SET ANSI_WARNINGS ON    
    
    ....
    ....
    
    GO
    
    0 讨论(0)
  • 2020-12-20 19:53

    Added this BEFORE your statement rather than at the start of the main query

    $result = mssql_query("SET ANSI_NULLS ON;");
    $result = mssql_query("SET ANSI_WARNINGS ON;"); 
    
    0 讨论(0)
  • 2020-12-20 19:59

    Its not often a better answer is on another forum - but according to this post, the SET commands must be before the CREATE PROCEDURE. Tested and works with SQL Server 2017.

    For example:

    SET ANSI_WARNINGS ON
    SET ANSI_NULLS ON 
    GO
    
    CREATE PROCEDURE dbo.access_update 
        @O_SQL_Error_State int = NULL OUTPUT
    AS
        ...
    
    0 讨论(0)
提交回复
热议问题