Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_MScreatelightweightprocstriggersconstraints

  No additional text.


Syntax
create procedure sys.sp_MScreatelightweightprocstriggersconstraints
	@pubid			uniqueidentifier,
	@artid			uniqueidentifier,
	@next_seed		bigint= NULL,	-- for id range mgt
	@range			bigint= NULL,	-- for id range mgt
	@threshold		int= NULL		-- for id range mgt
as
	set nocount on

	declare @retcode	int

	-- security check
    exec @retcode = sys.sp_MSreplcheck_subscribe
    if @retcode <> 0 or @@error <> 0 return 1

	begin tran
	save tran sp_MSlightweightprocsandtriggers

	-- create the procedures
	exec @retcode= sys.sp_MScreatelightweightarticleprocs @pubid= @pubid, @artid= @artid
	if @@error <>0 or @retcode <> 0 goto Failure

	-- create the triggers if the article is updateable
	if 1 = sys.fn_MSarticle_allows_DML_at_this_replica(@artid, default)
	begin
		exec @retcode= sys.sp_MScreatelightweighttriggers @artid= @artid
		if @@error <>0 or @retcode <> 0 goto Failure
	end
	else
	begin
		-- Create trigger that disallows local updates/inserts/deletes.
		exec @retcode= sys.sp_MScreatedownloadonlytriggers @artid= @artid
		if @@error <> 0 or @retcode <> 0 goto Failure
	end

	-- set the identity range
	if @range is not null
	begin
		declare @objid int

		select @objid= objid from dbo.sysmergearticles where
			pubid = @pubid and artid = @artid
		if @objid is null goto Failure
		
		exec @retcode= sys.sp_MSreseed
								@objid= @objid,
								@next_seed= @next_seed,
								@range= @range
		if @@error <>0 or @retcode <> 0 goto Failure

		if not exists (select objid from dbo.MSmerge_idrange where objid = @objid)
		begin
			insert into dbo.MSmerge_idrange	(objid, max_identity, range, threshold)
									values (@objid, @next_seed + @range, @range, @threshold)
		end
		if @@error <>0 or @retcode <> 0 goto Failure
	end

	commit tran
	return 0

Failure:
	rollback tran sp_MSlightweightprocsandtriggers
	commit tran
	return 1

 
Last revision 2008RTM
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