May 15, 2012

sp_MSget_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_MSget_oledbinfo(nvarchar @server
, nvarchar @infotype
, nvarchar @login
, nvarchar @password)

MetaData:

 create procedure sys.sp_MSget_oledbinfo  
@server nvarchar(128), -- the name by which the oledb datasource is referred to.
@infotype nvarchar(128) = NULL,
@login nvarchar(128) = NULL,
@password nvarchar(128) = NULL
AS

SET NOCOUNT ON

DECLARE @distproc nvarchar (255)
DECLARE @providername nvarchar(256)
DECLARE @datasource nvarchar(4000)
DECLARE @location nvarchar(4000)
DECLARE @providerstring nvarchar(4000)
DECLARE @catalog nvarchar(256)
DECLARE @retcode int

-- Security Check: require sysadmin
if (isnull(is_srvrolemember('sysadmin'),0) = 0)
begin
raiserror(21089,16,-1)
return (1)
end

select @providername = providername, @datasource = datasource, @location = location, @providerstring = providerstring, @catalog = catalog
from master.dbo.sysservers where UPPER(srvname collate database_default) = UPPER(@server) collate database_default

if (@@rowcount = 0)
begin
raiserror(15015, 16, -1, @server)
return (1)
end

exec @retcode = sys.xp_oledbinfo @providername, @datasource, @location, @providerstring, @catalog, @login, @password, @infotype
IF @@error <> 0
BEGIN
RAISERROR (14071, 16, -1)
RETURN (1)
END

No comments:

Post a Comment

Total Pageviews