Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_MSgentablenickname

  No additional text.


Syntax

create procedure sys.sp_MSgentablenickname
            @tablenick    int    output, @nickname int, @objid int
as

    declare @refcnt int
    declare @retval int

    /* Create a tablenickname from the following formula
    **        1.  Get the refcnt, use it for the high order digits so
    **            that processing inserts by ascending tablenickname works well
    **             and processing deletes by descending tablenickname works well.
    **        2.  Use a couple of digits from the nickname so that it is less likely
    **            to collide with tablenickname generated at another merge publisher.
    **        3.  Increment as necessary to make it unique within the publication and database.
    */
    exec @retval = sys.sp_MSrefcnt @objid, @refcnt output
    if @retval <> 0 return (1)

    if @nickname < 0
        set @nickname = 0 - @nickname

    /* the biggest value for int is 2147483647, we therefore use another algorithm when
    ** @refcnt is bigger than 200
    */
    if @refcnt < 200
    begin
        set @tablenick = 1000 * ((@refcnt * 10000) + (@nickname % 10000))
        while exists (select * from dbo.sysmergearticles where nickname = @tablenick)
            set @tablenick = @tablenick + 1
    end
    else
        select @tablenick=max(nickname) + 1 from dbo.sysmergearticles
    return (0)

 
Last revision 2008RTM
See also

  sp_addmergearticle (Procedure)
sp_MSdrop_rlcore (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