Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_MSadjust_pub_identity

  No additional text.


Syntax
CREATE PROCEDURE sys.sp_MSadjust_pub_identity
(
    @publisher			sysname,
    @publisher_db		sysname,
    @tablename			sysname,
    @current_max		bigint  = NULL,
    @threshold			int  = NULL,
    @range				bigint = NULL,
    @next_seed			bigint  = NULL,
    @pub_range			bigint  = NULL
)
AS
begin
    declare @retcode		int
    
    -- security check
    -- only db_owner can execute this
    
    if (is_member ('db_owner') != 1)
    begin
        raiserror(14260, 16, -1)
        return (1)
    end
    
    -- security check
    -- Has to be executed from distribution database
    
    if (sys.fn_MSrepl_isdistdb (db_name()) != 1)
    begin
        raiserror(21482, 16, -1, 'sp_MSadjust_pub_identity', 'distribution')
        return (1)
    end
    if @current_max is NOT NULL
    begin
    	update MSrepl_identity_range set current_max=@current_max
    		where tablename=@tablename and LOWER(publisher)=LOWER(@publisher) and publisher_db=@publisher_db
    	if @@ERROR<>0	
    		return (1)
    	if exists (select * from MSrepl_identity_range where max_identity is not NULL
    		and ABS(current_max) > ABS(max_identity))
    	begin
    		raiserror(21195, 16, -1)
    		return (1)
    	end
    end
    if @threshold is NOT NULL
    begin
        update MSrepl_identity_range set threshold=@threshold
        	where tablename=@tablename and LOWER(publisher)=LOWER(@publisher) and publisher_db=@publisher_db
        if @@ERROR<>0	
        	return (1)
    end
    if @next_seed is NOT NULL
    begin
        update MSrepl_identity_range set next_seed=@next_seed
        	where tablename=@tablename and LOWER(publisher)=LOWER(@publisher) and publisher_db=@publisher_db
        if @@ERROR<>0
        	return (1)
    end
    if @range is NOT NULL
    begin
        update MSrepl_identity_range set range=@range
        	where tablename=@tablename and LOWER(publisher)=LOWER(@publisher) and publisher_db=@publisher_db	
        if @@ERROR<>0
        	return (1)
    end
    if @pub_range is NOT NULL
    begin
        update MSrepl_identity_range set pub_range=@pub_range
        	where tablename=@tablename and LOWER(publisher)=LOWER(@publisher) and publisher_db=@publisher_db	
        if @@ERROR<>0
        	return (1)
    end

    return (0)
end

 
Last revision 2008RTM
See also

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