Results 1 to 7 of 7
  1. #1
    Join Date
    May 2007
    Posts
    7

    Question Unanswered: Can i apply any conditon on Replication ,before publishing the data?

    i want to use Replication in sql server 2000 at specified condtion ,mean if any condition is satisfied then the data is publish to subscriber database?

  2. #2
    Join Date
    Jan 2004
    Location
    In a large office with bad lighting
    Posts
    1,040
    Extracted from BOL:

    Filtering Published Data

    Filtering data during replication allows you to publish only the data or partitions of data that are needed at the Subscriber. You can filter data to create partitions that include only the columns and/or only the rows that you specify for replication.
    With all types of replication, you can choose to copy and distribute complete tables, or data filtered horizontally or vertically with static filters. Merge replication is especially strong in filtering options, and you can use dynamic filters to customize the filter based on a property of the Subscriber receiving the data.
    Filtering data horizontally allows you to publish only the data that is needed, partition data to different sites, avoid conflicts (because Subscribers will be viewing and updating different subsets of data), and manage publications based on user needs or applications.
    Additionally, you have the option of employing user-defined functions in your static and dynamic filters and leveraging the power of customized functions.

    -- This is all just a Figment of my Imagination --

  3. #3
    Join Date
    May 2007
    Posts
    7

    Question Thanks Tomh,i need to clear more my concepts?

    Thanks Tomh,i got the idea what you are trying to say, this can be done from filtering horizontally or vertically option when we Select “Yes, I will define data filters, enable anonymous subscriptions, or customize other properties”.

    i am explaining what i want to do,i want to apply condition let suppose:

    if users.usersId between 10 and 20
    begin

    -- replication perform

    end

    and u said in ur comments we can also use or apply user defined function can u give me example of it and where should i call this UDF.

    thanks in advance

  4. #4
    Join Date
    Jan 2004
    Location
    In a large office with bad lighting
    Posts
    1,040
    I've never had to use UDFs to filter, so I don't have an example to give you.

    I would suggest you do two things:

    1. Experiment ... set up a test replication and work thru simple horizontal (your userid example) and vertical filtering (column subset), then when you have that working, try incorporating functions into the filtering.

    2. Search the microsoft.public.sqlserver groups for more information, as well as use GOOGLE to search for user written articles to help lead you to your final result.

    You will notice that most of the answers on this forum come from members working thru real life situations that have been overcome by testing and finding the many different ways things don't work before finding the one that does.

    Join us and be part of the solution!

    -- This is all just a Figment of my Imagination --

  5. #5
    Join Date
    Dec 2002
    Posts
    1,245
    I think a horizontally filtered replication (either merge or transactional) would work just fine for you in this situation. It seems that it would be a bit simpler since it's not dynamic (or it does not appear to be from your description).

    As tomh suggested, set up a test environment and practice with it. Replication can be tedious and very involved. Learn all you can, test variouse scenarios, document the test conditions and outcomes and develop your plans accordingly.

    Regards,

    hmscott
    Have you hugged your backup today?

  6. #6
    Join Date
    Nov 2004
    Posts
    128
    Quote Originally Posted by aamir1

    if users.usersId between 10 and 20
    begin

    -- replication perform

    end
    if users.usersId between 10 and 20
    begin

    exec msdb..sp_start_job 'replicationJobName'
    end

  7. #7
    Join Date
    May 2007
    Posts
    7
    Hy guys it works when i did sample example to test data for (merge replication), from row filter and dynamic row filter we can apply conditions (like where clause)

    Thnx to all u guys ur guidance very valueable for me thnx to all once again

    one thing which would i want to know is that like cfr want to say to write UDF in a specific condition ,i am unable to do like this Guys do u have any idea? where i should call UDF ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •