SQL Server Performance

Adding uniqueidentifier in Merge Replication

Discussion in 'Performance Tuning for SQL Server Replication' started by nilayt, Nov 1, 2003.

  1. nilayt New Member

    Hello,

    Can someone provide me script to add this column in a table?

    Thank you.

    -Nilay
  2. satya Moderator

    Use ALTER TABLE... statement to add uniqueidentifierand set NOT FOR REPLICATION option to the IDENTITY column.

    _________
    Satya SKJ
    Moderator
    SQL-Server-Performance.Com
  3. nilayt New Member

    This script should be ok?

    Alter table [dbo].[Client] add rowguid uniqueidentifier ROWGUIDCOL default newid() not null

    UPDATE [dbo].[Client] SET [rowguid] = DEFAULT

    -Nilay
  4. Twan New Member

    yep looks right to me, you won't need the update since the alter table already has a default

    Cheers
    Twan
  5. satya Moderator

    Yes, and you can check it yourself by parsing the query using QA (just in case).

    _________
    Satya SKJ
    Moderator
    SQL-Server-Performance.Com
  6. nilayt New Member

    I think I forgot here that we need to put index on that column.
  7. Twan New Member


    yep you will need a unique index on the column...

    create unique index iux_client_rowguid on dbo.client ( rowguid )

    Cheers
    Twan

Share This Page