April 27, 2012

sp_helpreplicationdb (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_helpreplicationdb(nvarchar @dbname
, nvarchar @type)

MetaData:

 create procedure sys.sp_helpreplicationdb  
@dbname sysname = '%', @type sysname = 'pub'
AS

SET NOCOUNT ON

--
-- Declarations.
--

DECLARE @retcode int, @typebit int

if (lower(@type collate SQL_Latin1_General_CP1_CS_AS) like 'pub%')
select @typebit = 1
else if (lower(@type collate SQL_Latin1_General_CP1_CS_AS) like 'sub%')
select @typebit = 2
else
begin
raiserror(14091,-1,-1)
return 1
end

--
-- Parameter Check: @dbname.
-- Check to make sure that the database name conforms to the rules
-- for identifiers.
--

IF @dbname <> '%'
BEGIN
EXECUTE @retcode = sys.sp_validname @dbname

IF @@ERROR <> 0 OR @retcode <> 0
RETURN (1)
END

--
-- Show databases with this option enabled.
--

SELECT name
FROM master.dbo.sysdatabases
WHERE ((@dbname = N'%') or (name = @dbname collate database_default))
AND (category & @typebit) <> 0

No comments:

Post a Comment

Total Pageviews