SQL-Server error 7405 error solution (link server query)

xiaoxiao2021-03-06  42

Problem Description:

Query statement is "SELECT *" [Remote Service Name]. [Database Name]. [DBO]. [Table Name],

The result is performed normally in the SQL query analyzer, but put this statement in the stored procedure.

The following error "The heterogeneous query requires the ANSI_NULLS and ANSI_WARNINGS options for the connection.

This will ensure consistent query semantics. Please enable these options and re-issue the query.

[SQLSTATE 42000] (Error 7405). Step failed. "

Even if the "SET ANSI_NULLS ON" statement is executed, it will not work.

Solution:

1. You can use OpenDataSource, there is a specific description in OnlineHelp

OpenDataSource

SELECT *

From OpenDataSource

'Sqloledb',

'Data Source = ServerName; User ID = SA; Password ='

.Awfi.dbo.temp

2. But the above method cannot solve the prompt information when creating a stored procedure in the enterprise manager.

SET ANSI_WARNINGS ON

SET ANSI_NULLS ON

Go

You can add as mentioned before the stored procedure CREATE statement.

转载请注明原文地址:https://www.9cbs.com/read-71061.html

New Post(0)