May 7, 2012

sp_MScdc_logddl (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_MScdc_logddl(int @source_object_id
, nvarchar @ddl_command
, binary @ddl_lsn
, nvarchar @ddl_time
, binary @commit_lsn
, int @source_column_id
, bit @fis_alter_column
, bit @fis_drop_table)

MetaData:

 create procedure sys.sp_MScdc_logddl   
(
@source_object_id int
,@ddl_command nvarchar(max)
,@ddl_lsn binary(10)
,@ddl_time nvarchar(1000)
,@commit_lsn binary(10)
,@source_column_id int = null
,@fis_alter_column bit = 0
,@fis_drop_table bit = 0
)
AS
begin
set nocount on

declare @retcode int
,@db_name sysname
--
-- security check - should be dbo or sysadmin
--
exec @retcode = sp_MSreplcheck_publish
if @@ERROR != 0 or @retcode != 0
return 1

--
-- security check
-- Has to be executed from cdc enabled db
--
if not exists (select * from sys.databases where database_id = db_id() and is_cdc_enabled = 1)
begin
set @db_name = db_name()
RAISERROR(22901, 16, -1, @db_name)
return (1)
end

-- Switch explicitly to execute as database 'cdc' user
execute as user = 'cdc'

-- Call internal stored procedure to actually do the work
exec @retcode = sys.sp_cdc_logddl_internal
@source_object_id
,@ddl_command
,@ddl_lsn
,@ddl_time
,@commit_lsn
,@source_column_id
,@fis_alter_column
,@fis_drop_table

-- Revert to authorization of caller
revert

return @retcode
end

No comments:

Post a Comment

Total Pageviews