RE: stored proc ansi_nulls help
From: Pablo (Pablo_at_discussions.microsoft.com)
Date: 07/28/04
- Next message: Sensei: "Re: SQL Server 2000 Dynamic SQL and Temp Tables"
- Previous message: Anith Sen: "Re: a question on SQL query"
- In reply to: Josh: "stored proc ansi_nulls help"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 28 Jul 2004 11:00:03 -0700
Hi,
You also need to have
ANSI_NULLS = ON
ANSI_WARNINGS = ON
on connection which execute your SP.
Check it by
----
DBCC USEROPTIONS
EXEC [dbo].[spTEST] 'localhost'
---
Regards,
Pablo
"Josh" wrote:
> When I execute a call to a stored proc that calls openrowset to another server I get the following error:
>
> Server: Msg 7405, Level 16, State 1, Line 1
> 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.
>
> I put the ansi nulls and ansi warnings in when building the proc but am still recieving the error. Why?
>
>
> Script to create proc via query analyzer:
>
> SET ANSI_NULLS ON
> go
> SET ANSI_WARNINGS ON
> GO
> CREATE PROCEDURE spJOBSTAT_STATUS_LOOKUP
>
> @SRV_NA sysname
>
> AS
>
> declare @strSQL varchar(5000)
>
>
> set @strSQL = ' select job_id, originating_server, name, enabled, last_run_date, last_run_time, last_run_outcome from OPENROWSET(''MSDASQL'', '
> set @strSQL = @strSQL + ' ''DRIVER={SQL Server};SERVER='+@SRV_NA+';UID=blah;PWD=A4$$q1@dm1n'', '
> set @strSQL = @strSQL + ' '' set fmtonly off exec msdb..sp_help_job'')'
>
> --select @strSQL
> exec(@strSQL)
- Next message: Sensei: "Re: SQL Server 2000 Dynamic SQL and Temp Tables"
- Previous message: Anith Sen: "Re: a question on SQL query"
- In reply to: Josh: "stored proc ansi_nulls help"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|