Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_MSarticlecolstatus

  No additional text.


Syntax
create procedure sys.sp_MSarticlecolstatus (
    @artid int,
    @tabid int,
    @colid int,
    @type nvarchar (10),      /* 'publish', 'nonsqlsub' */
    @status bit OUTPUT)
    AS

    SELECT @status = 0
    declare @OPT_ENABLED_FOR_HET_SUB tinyint
    set @OPT_ENABLED_FOR_HET_SUB = 0x4

    IF LOWER(@type collate SQL_Latin1_General_CP1_CS_AS) = N'nonsqlsub'
    BEGIN

        
        -- Check all active or subscribed articles for the column.
        

    -- Basically, we need to check the following
    -- 1. Whether the column is published in a publication that allows
    --    heterogeneous subscriptions and has subscriptions on it
    -- 2. Whether the column has any initiated subscriptions (during concurrent
    --    snapshot of another publication) even virtual ones
	IF EXISTS( SELECT sub.artid
                 FROM dbo.sysarticles art
           INNER JOIN dbo.syssubscriptions sub
                   ON art.artid = sub.artid
                  AND art.objid = @tabid
           INNER JOIN dbo.syspublications pub
                   ON art.pubid = pub.pubid
           INNER JOIN dbo.sysarticlecolumns sac
                   ON art.artid = sac.artid
                  AND sac.colid = @colid
                WHERE art.artid <> @artid
                  AND ((sub.status in (1,2) AND (pub.options & @OPT_ENABLED_FOR_HET_SUB) = @OPT_ENABLED_FOR_HET_SUB) -- 1.
                   OR (sub.status = 3)) ) -- 2.
	BEGIN
	    SELECT @status = 1
	END
    END
    ELSE
    BEGIN

        
        -- Check all articles for the column.
        
		declare @cdc_tracked_tables table (object_id int)
		
		if object_id('cdc.change_tables') is not null
		begin
			insert @cdc_tracked_tables select distinct source_object_id from cdc.change_tables
		end

        IF EXISTS( SELECT art.artid FROM sysarticles art join sysarticlecolumns sac
						on art.artid = sac.artid
                   WHERE art.objid = @tabid
                   AND art.artid <> @artid
                   AND sac.colid = @colid)
			or exists (select * from @cdc_tracked_tables where object_id = @tabid)
        BEGIN
            SELECT @status = 1
        END
    END

    RETURN (0)

 
Last revision 2008RTM
See also

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