June 6, 2012

sp_oledbinfo (Transact-SQL MetaData) Definition

Please note: that the following source code is provided and copyrighted by Microsoft and is for educational purpose only.
The meta data is from an SQL 2012 Server.

I have posted alot more, find the whole list here.

Goto Definition or MetaData

Definition:

sys.sp_oledbinfo(nvarchar @server
, nvarchar @infotype
, nvarchar @login
, nvarchar @password)

MetaData:

 create procedure sys.sp_oledbinfo  
@server nvarchar(128),
@infotype nvarchar(128) = NULL,
@login nvarchar(128) = NULL,
@password nvarchar(128) = NULL
AS

SET NOCOUNT ON

DECLARE @distributor sysname
DECLARE @distproc nvarchar (255)
DECLARE @retcode int

--
-- Security Check: require sysadmin
--
IF (ISNULL(IS_SRVROLEMEMBER('sysadmin'),0) = 0)
BEGIN
RAISERROR(21089,16,-1)
RETURN (1)
END

--
-- Get distribution server information for remote RPC
-- subscription calls.
--

EXEC @retcode = sys.sp_MSrepl_getdistributorinfo @rpcsrvname = @distributor OUTPUT
IF @@error <> 0 OR @retcode <> 0
BEGIN
RAISERROR (14071, 16, -1)
RETURN (1)
END

select @distproc = QUOTENAME(rtrim(@distributor)) + '.master.sys.sp_MSget_oledbinfo'
exec @retcode = @distproc @server, @infotype, @login, @password
IF @@error <> 0
BEGIN
RAISERROR (14071, 16, -1)
RETURN (1)
END

No comments:

Post a Comment

Total Pageviews