May 25, 2012

sp_MSrepl_isdbowner (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_MSrepl_isdbowner(nvarchar @dbname)

MetaData:

 create procedure sys.sp_MSrepl_isdbowner   
@dbname sysname
AS
BEGIN
SET NOCOUNT ON
DECLARE @retcode int
DECLARE @cmd nvarchar(1000)
DECLARE @isdbowner int

SELECT @retcode = has_dbaccess(@dbname)
IF (@retcode IS NULL) OR (@retcode = 0)
BEGIN
--
-- Either no access or database not found
-- No need to go further
--
RETURN 0
END

SELECT @cmd = 'USE ' + quotename(@dbname) + ' SELECT @isdbowner = is_member(''db_owner'')'
EXEC sys.sp_executesql @cmd, N'@isdbowner int output', @isdbowner output

RETURN isnull(@isdbowner, 0)
END

No comments:

Post a Comment

Total Pageviews