Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_MStran_alterschemaonly

  No additional text.


Syntax
create procedure sys.sp_MStran_alterschemaonly
(
	@qual_object_name nvarchar(512) --qualified 3-part-name			
	,@objid	int
	,@pass_through_scripts nvarchar(max)
	,@target_object_name nvarchar(512) = NULL
)

AS
	set nocount on

	declare @tran_artid int
			,@retcode int
			,@subscription_active int
			,@include_ddl int

	select @include_ddl = 0x1
		,@subscription_active = 2
		,@retcode = 0

/*
	--a tiny optimization, if there is no table based iv, no need to check for this.
	--otherwise, check for 21845 condition
	if exists(select 1 from sysarticles where objectproperty(objid, 'IsView') = 1 or objectproperty(objid, 'IsProcedure') = 1)
	begin
		if sys.fn_ftableivprocexec(@objid) = 1
		begin
			raiserror (21845, 16, 1, @qual_object_name)
			return 1
		end
	end
*/
	begin tran sp_MStran_alterschemaonly
	save tran sp_MStran_alterschemaonly
	--loop through relavent publications/articles
	declare #trancolumn CURSOR LOCAL FAST_FORWARD for
		select distinct a.artid
			from sysextendedarticlesview a
			join syspublications p on a.pubid = p.pubid
			join dbo.syssubscriptions s on a.artid = s.artid
			where a.objid = @objid
					and s.status = @subscription_active
					and (p.replicate_ddl & @include_ddl) = @include_ddl

	open #trancolumn
	fetch #trancolumn into @tran_artid
	while (@@fetch_status <> -1)
	BEGIN
		exec @retcode = sys.sp_MStran_autoproc @artid = @tran_artid
				  								,@ddlcmd = @pass_through_scripts
		if @retcode <>0 or @@ERROR<>0
			goto DROPTRAN
		fetch #trancolumn into @tran_artid
	END
	close #trancolumn
	deallocate #trancolumn

	commit tran sp_MStran_alterschemaonly
	return 0

DROPTRAN:
	close #trancolumn
	deallocate #trancolumn

FAILURE:
	rollback tran sp_MStran_alterschemaonly
	commit tran
	return 1

 
Last revision 2008RTM
See also

  sp_MSdrop_repltran (Procedure)
sp_MStran_alterview (Procedure)
sp_MStran_ddlrepl (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