Creates a replication filter object that defines conditions that RepAgent applies to a table in the Adaptive Server database.
create replication filter <filter_name> on <table_name> as <filter clause>
Operator | Meaning |
---|---|
= | Equal to |
> | Greater than |
< | Less than |
>= | Greater than or equal to |
<= | Less than or equal to |
!= | Not equal to |
<> | Not equal to |
!> | Not greater than |
!< | Not less than |
Comparison operators – greater than ">":
Create a filter named advance_vs_revenue for the sales table to select only records where the value in the advance column multiplied by 2 is more than the value in the total_sales column multiplied by the value in the price column:
create replication filter advance_vs_filter on sales as advance * 2 > total_sales * price
Ranges – between:
Create a filter named filter_in__sales for the sales table to select only records where the values in the total_sales column are between 4095 and 12000 :
create replication filter filter_in_sales on sales as total_sales between 4095 and 12000
Ranges – not between:
Create a filter named filter_out_sales for the sales table to select only records where the values in the total_sales column are not between 4095 and 12000 :
create replication filter filter_out_sales on sales as total_sales not between 4095 and 12000
Lists – in:
Create a filter named state_in for the sales table to select only records where the state in the state column is one of CA, IN, or MD:
create replication filter state_in on sales as state in ("CA", "IN", "MD")
Lists – not in:
Create a filter named state_out for the sales table to select only records where the state in the state column is not one of CA, IN, or MD:
create replication filter state_out on sales as state not in ("CA", "IN", "MD")
Character matches – like:
Create a filter named author_lastname for the books table to select only records with author last names in the au_lname column that meet the "[CK]ars[eo]n" seach condition where the last names must have "C" or "K" as the first character, followed by "a", "r", and "s" in that order, "e", or "o" as the next character, and "n" as the last character:
create replication author_lastname on books as au_lname like "[CK]ars[eo]n"
Character matches – not like:
Create a filter named not_phone_num for the contacts table to select only records with telephone numbers in the phone column that do not contain the digits "415" at the beginning of the telephone number:
create replication not_phone_num on contacts as phone not like "415%"
Unknown values – null:
Create a filter named advance_null for the sales table to select only records with null values in the advance column:
create replication advance_null on sales as advance is null
Known values – not null:
Create a filter named advance_not_null for the sales table to select only records with values that are not null in the advance column:
create replication advance_not_null on sales as advance is not null
Combinations of search conditions – <, or, between:
Create a filter named advance_vs_totalsales for the sales table to select only records where either the value in the advance column is less than 5000, or the value in the total_sales column is between 2000 and 2500:
create replication advance_vs_totalsales on sales as advance < 5000 or total_sales between 2000 and 2500
Built-in expressions – getdate():
Create a filter named older for the sales table to select only records where the value in the date column is older than the current date:
create replication older on sales as date > getdate()
Boolean values – true:
Create a filter named all_rows for the sales table to select all records in the table:
create replication all_rows on sales as true
Replication Server replicates create replication filter in warm standby applications.