sp_articlefilter (T-SQL)

Creates a filter stored procedure to horizontally filter data replicated from a published table. Only unsubscribed articles can be modified by this stored procedure.

Syntax

sp_articlefilter [@publication =] 'publication', [@article =] 'article'
    [,[@filter_name =] 'filter_name'] [,[@filter_clause =] 'filter_clause']

Arguments
[@publication =] 'publication'
Is the name of the publication that contains the article. publication is sysname, with no default.
[@article =] 'article
Is the name of the article. article is sysname, with no default.
[@filter_name =] 'filter_name'
Is the name of the filter stored procedure to be created from the filter_name. filter_name is nvarchar(386), with a default of NULL.
[@filter_clause =] 'filter_clause'
Is a restriction (WHERE) clause that defines a horizontal filter. When entering the restriction clause, omit the keyword WHERE. filter_clause is ntext, with a default of NULL.
Return Code Values

0 (success) or 1 (failure)

Remarks

sp_articlefilter creates the filter, inserts the ID of the filter stored procedure in the filter column of the sysarticles table, and inserts the text of the restriction clause in the filter_clause column.

To create an article with a horizontal filter, execute sp_addarticle with no filter parameter. Execute sp_articlefilter, providing all parameters including filter_clause. Then execute sp_articleview, providing all parameters including the identical filter_clause. If the filter already exists and if the type in sysarticles is 1 (log-based article), the previous filter is deleted and a new filter is created.

If filter_name and filter_clause are not provided, the previous filter is deleted and the filter ID is set to 0.

Permissions

Only members of the sysadmin fixed server role or db_owner fixed database role can execute sp_articlefilter.

See Also
sp_addarticle sp_articleview
sp_articlecolumn System Stored Procedures

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.