Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_MShelpmergeidentity

  No additional text.


Syntax
create procedure sys.sp_MShelpmergeidentity
    @publication sysname
as
    declare @pubid                  uniqueidentifier
    declare @artid                  uniqueidentifier
    declare @nickname               int
    declare @next_seed              bigint
    declare @retcode                int
    declare @tablename              sysname
    declare @range                  bigint
    declare @threshold              int
    declare @db_name                sysname
    declare @tmp_table TABLE (tablename sysname, next_seed bigint, range bigint, threshold int, nickname int)
    declare @publishingservername sysname
    declare @subid uniqueidentifier

    /*
    ** To public.
    */
    set nocount on
    if (@publication is null)
    begin
        RAISERROR(14003, 16, -1)
        return (1)
    end

    select @db_name = db_name()
    		,@publishingservername = publishingservername()

    /*
    ** Security Check.
    */
    exec @retcode = sys.sp_MSmerge_validate_publication_presence @publication, @db_name, @publishingservername, @pubid output
    if @retcode <> 0 or @@error <> 0
        return 1


    select TOP 1 @artid=artid, @nickname=nickname from dbo.sysmergearticles where pubid=@pubid and identity_support=1 order by nickname ASC
    while (@artid is not NULL)
    begin
        -- we need a local subid to look up the entry in MSmerge_identity_range
        select @subid=subid from dbo.MSmerge_identity_range where artid=@artid and is_pub_range=1 and (sys.fn_MSmerge_islocalsubid(subid)=1)

        insert @tmp_table (tablename, next_seed, range, threshold, nickname)
            select object_name(a.objid), i.max_used, a.range, a.threshold, a.nickname
            from dbo.sysmergearticles a
                inner join dbo.MSmerge_identity_range i on i.artid=a.artid and i.subid=@subid and i.is_pub_range=1
            where a.artid = @artid and a.pubid = @pubid
        if @@ERROR<>0
        begin
            raiserror(21197, 16, -1)
            return (1)
        end
        select @artid = NULL
        select TOP 1 @artid=artid, @nickname=nickname from dbo.sysmergearticles
            where pubid=@pubid and nickname>@nickname and identity_support=1 order by nickname ASC
    end
    select t.* from @tmp_table t, dbo.sysmergearticles sma
    where t.nickname = sma.nickname
    and sma.pubid = @pubid
    order by sma.processing_order ASC, sma.nickname ASC

    return (0)

 
Last revision 2008RTM
See also

  sp_MSdrop_rlrecon (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