Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_cdc_cleanup_job_internal

  No additional text.


Syntax
create procedure [sys].[sp_cdc_cleanup_job_internal]
(
	@retention bigint,
	@threshold bigint
)	
as
begin
	declare @retcode int
			,@is_cdc_enabled bit
			,@stmt nvarchar(1000)
			,@uses_cleanup_process bit
			,@low_water_mark binary(10)
			,@db_name sysname
			,@xstr nvarchar(22)
			,@old_low_water_mark binary(10)
	
    set nocount on

    set @db_name = db_name()

    -- Compute a new low water mark based upon the database retention time.
    set @low_water_mark = [sys].[fn_cdc_compute_low_water_mark](@retention)
    if (@@error != 0)
    begin
		raiserror(22923, 16, -1, @db_name, @retention)
        return 1
    end

	-- If the returned low water mark is non-null we need to update
	-- the start_lsn values in cdc.change_tables to reflect the new
	-- low water mark.
    if (@low_water_mark is not null)
    begin

		update [cdc].[change_tables]
		set start_lsn = @low_water_mark
		where start_lsn < @low_water_mark

        if (@@error <> 0)
        begin
			raiserror(22851, 16, -1, @db_name)
			return 1
        end

    end


    -- We come here whether or not the low water mark has been modified. This allows
    -- us to use a best effort approach when deleting entries from the change tables.
    -- If all obsolete entries do not get removed on any given run, attempts will
    -- continue to be made on subsequent runs.
    exec [sys].[sp_cdc_cleanup_change_tables]
		@threshold, null

    return 0

end

 
Last revision 2008RTM
See also

  sp_MScdc_cleanup_job (Procedure)
sp_MSdrop_cdc (Procedure)
       



News

  Query a named instance
Sybase+ASE+silent+install
SQL 2008 R2
Deprecated procedures in SQL2008
Reporting Services item-level role definitions
Create all your missing indexes
Converting datetime field
Start MSSQL Server Profiler at time
Replicating MSSQL Server views
Exploring Microsoft Sharepoint
The OLE DB provider "SQLNCLI10" for linked server indicates.
Mobile solar charger
Oracle to SQL Server replication
Cannot insert the value NULL into column
Undocumented Microsoft SQL Server 2008
VMware
Zoekmachine optimalisatie
SQL Servers hidden objects
FckEditor
Flash in Ajax
De hype die AJAX heet
Barcode scannen
MySQL; Gratis, makkelijk en snel!
PHP
sIFR; de combinatie tussen HTML en Flash