BUG: Cannot use SQL Enterprise Manager to create stored procedures containing linked server objects (296769)



The information in this article applies to:

  • Microsoft SQL Server 2000 (all editions)

This article was previously published under Q296769
BUG #: 351020 (SHILOH_BUGS)

SYMPTOMS

When you use SQL Server 2000 Enterprise Manager (SEM) to create a stored procedure containing queries that use linked server objects, you may receive the following error:
Error 7405: Heterogeneous queries require the ANSI_NULLS and ANSI_WARNINGS
options to be set for the connection. This ensures consistent query
semantics. Enable these options and then reissue your query.

CAUSE

By default, SQL Server 2000 Enterprise Manager sets ANSI_NULLS to OFF before creating a stored procedure.

WORKAROUND

To work around this problem, explicitly set ANSI_NULLS to ON in the stored procedure property dialog box as shown below:
Set ANSI_NULLS ON
Go
Create Proc spXXXX as
select * from [Linkedserver].pubs.dbo.authors
.
.
				
Another workaround is to create the stored procedure from Query Analyzer. Note that the default ANSI setting for Query Analyzer must be set to ON in order for this to work.

STATUS

Microsoft has confirmed this to be a problem in SQL Server 2000.

MORE INFORMATION

SQL Server 2000 Enterprise Manager can be used to edit existing stored proceduress; it will retain whatever ANSI_NULLS settings were used when a stored procedure was initially created.

Modification Type:MinorLast Reviewed:12/23/2005
Keywords:kbbug kbpending KB296769