Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_IHexecresultset

  No additional text.


Syntax


-- Name:
--          sp_IHexecresultset

-- Description:
--          Executes xp_execresultset in sa context

-- Security:
--          Internal

-- Returns:
--          Error code

-- Owner:
--          acarter

-- Notes:
--			Uses EXECUTE AS 'dbo' to get to sa user to make
--			sure the right linked server login mapping is used


CREATE PROCEDURE sys.sp_IHexecresultset
(
    @cmd	nvarchar(4000),
    @dbname	sysname = NULL,
    @debug	bit = 0
)
WITH EXECUTE AS 'dbo'
AS
BEGIN
	DECLARE @retcode int

	-- Execute query
	BEGIN TRY
            EXEC @retcode = sys.xp_execresultset N'SELECT cmd FROM #hquery ORDER BY seq', @dbname
	END TRY
	BEGIN CATCH
           SET @retcode = 1
			declare @number int
				,@sev int
				,@state int
				,@msg nvarchar(max)
			select @number = ERROR_NUMBER(), @sev = ERROR_SEVERITY(), @state = ERROR_STATE(), @msg = ERROR_MESSAGE()
			raiserror('Error: %d, Sev: %d, State: %d, Msg: %s', 10, 1, @number, @sev, @state, @msg)
	END CATCH

	RETURN @retcode
END

 
Last revision 2008RTM
See also

  sp_IHquery (Procedure)
sp_MSdrop_replcom (Procedure)
sp_ORAremotequery (Procedure)
       



News

  Query a named instance
Sybase+ASE+silent+install
SQL 2008 R2
Deprecated procedures in SQL2008
Reporting Services item-level role definitions
Create all your missing indexes
Converting datetime field
Start MSSQL Server Profiler at time
Replicating MSSQL Server views
Exploring Microsoft Sharepoint
The OLE DB provider "SQLNCLI10" for linked server indicates.
Mobile solar charger
Oracle to SQL Server replication
Cannot insert the value NULL into column
Undocumented Microsoft SQL Server 2008
VMware
Zoekmachine optimalisatie
SQL Servers hidden objects
FckEditor
Flash in Ajax
De hype die AJAX heet
Barcode scannen
MySQL; Gratis, makkelijk en snel!
PHP
sIFR; de combinatie tussen HTML en Flash