Replicate with identity columns

  • I want an exact replica of my db as it changes on another server. i tried snapshot replication but it does not setup identity columns.Is there a way i can set this to replicate with the identity columns in tact?

    Thanks in advance

  • Transactional with queued updates or merge, either will do it. The reason both support it is because both support writes to the subscriber. Most of the time replication is used to create a copy used for reads only.

    Andy

    http://www.sqlservercentral.com/columnists/awarren/

  • If you add the NOT FOR REPLICATION to the identity columns you can then create a script to run before the snapshot is applied that creates the schema. Then run snapshot replication using the pre-snapshot script option. This will give you a READ-ONLY subscription, as when data is changed in the table you would get a conflict on the identity column if you were to try to merge the data back. If you want to merge identity columns then look into managed identities (I'm just converting a database to do away with them and going to uniqueidentifiers instead).

    Gary Johnson

    Microsoft Natural Language Group

    DBA, Sr. DB Engineer




    Gary Johnson
    Microsoft Natural Language Group
    DBA, Sr. DB Engineer

    This posting is provided "AS IS" with no warranties, and confers no rights. The opinions expressed in this post are my own and may not reflect that of my employer.

  • Gary, curious to why you're moving to uniqueidentifiers? I like them myself, but most DBA's don't (or at least the ones that don't always responsd when I say something about them!).

    Andy

    http://www.sqlservercentral.com/columnists/awarren/

  • I'm changing to uniqueidentifiers because I'm tired of dealing with the managed identities. I have had to repair data every month since I started working on this database for the last 18 months due to one problem or another with the managed identities having conflicts. Going to uniqueidentifiers with stop that from happening. This happens because I have to keep adding/removing subscriptions and the managed identity ranges will sometimes get reassigned a range that existed before. Overall not a good situation. Unfortunately the uniqueidentifiers are going to bloat the database and cause some serious performance problems. Plus since you can't do a count on them I have had to change the way some SP's were written. We'll see in a month or two if this was the right thing to do.

    Gary Johnson

    Microsoft Natural Language Group

    DBA, Sr. DB Engineer




    Gary Johnson
    Microsoft Natural Language Group
    DBA, Sr. DB Engineer

    This posting is provided "AS IS" with no warranties, and confers no rights. The opinions expressed in this post are my own and may not reflect that of my employer.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply