Home Microsoft SQL Server DigiMailing iRN Contact


  No additional text.

create procedure sys.sp_MShelpmergeidentity
    @publication sysname
    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)
        RAISERROR(14003, 16, -1)
        return (1)

    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)
        -- 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
            raiserror(21197, 16, -1)
            return (1)
        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
    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)


  Query a named instance
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
Zoekmachine optimalisatie
SQL Servers hidden objects
Flash in Ajax
De hype die AJAX heet
Barcode scannen
MySQL; Gratis, makkelijk en snel!
sIFR; de combinatie tussen HTML en Flash