create procedure sys.sp_MStran_alterview
(
@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
,@artname sysname
,@pubname sysname
,@retcode int
,@subscription_active int
select @subscription_active = 2
,@retcode = 0
begin tran sp_MStran_alterview
save tran sp_MStran_alterview
-- disallow alter indexed view replicated as table, otherwise pub/sub can get out of sync
-- (the only time a vew exists in sysarticles is when indexed view is replicated as table)
if exists (select * from sysarticles where objid = @objid)
begin
raiserror(21725, 16, -1)
goto FAILURE
end
--loop through schema only publications/articles
exec @retcode = sys.sp_MStran_alterschemaonly @qual_object_name = @qual_object_name
,@objid = @objid
,@pass_through_scripts = @pass_through_scripts
if @retcode <>0 or @@ERROR<>0
goto FAILURE
commit tran sp_MStran_alterview
return 0
FAILURE:
rollback tran sp_MStran_alterview
commit tran
return 1