What is the sys.sp_MSmakegeneration

290 Views Asked by At

We have set up a merge replication in SQL Server. One of our biggest deadlocks is this stored procedure up above that is run by subscribers.

CREATE PROCEDURE sys.sp_MSmakegeneration
    @gencheck int = 0,
    @commongen bigint = NULL, 
    @commongenguid uniqueidentifier = NULL,
    @commongenvalid int = NULL OUTPUT,
    @compatlevel int = 90
AS
    SET NOCOUNT ON
    DECLARE @gen bigint
, @replnick binary(6)
, @dt datetime
, @art_nick int
, @first_ts int
, @makenewrow bit
, @retcode smallint
, @nickbin varbinary(255)
, @maxgendiff_fornewrow bigint
, @count_of_articles int
, @lock_acquired bit
, @lock_resource nvarchar(255)
, @procfailed bit
, @delete_old_genhistory bit
, @close_old_genhistory bit
, @changecount int
, @dbname nvarchar(258)
, @processing_order int
, @prev_processing_order int
, @prev_art_nick int
, @force_leveling bit
, @gen_change_threshold int

declare @cmd nvarchar(4000)
declare @old_bi_gen bigint
declare @bi_view_objid int
--declare @GENSTATUS_OPEN tinyint
--declare @GENSTATUS_MERGE_INSERTED_OPEN tinyint
--declare @GENSTATUS_LOCAL_CLOSED tinyint
--declare @GENSTATUS_TEMPORARILY_CLOSED tinyint

What does this stored procedure exactly do here?

And why should it be repeatedly called while it exists there?

0

There are 0 best solutions below