Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2003
    Location
    KY
    Posts
    146

    Unanswered: How to find out tables which can't be replicated

    Is there any query to find out all the tables without a Primary key or without a Unique index ?

  2. #2
    Join Date
    Jul 2002
    Location
    Village, MD
    Posts
    621
    select * from INFORMATION_SCHEMA.TABLES where TABLE_NAME not in(
    select TABLE_NAME from INFORMATION_SCHEMA.TABLE_CONSTRAINTS where CONSTRAINT_TYPE in('PRIMARY KEY', 'UNIQUE')
    )

  3. #3
    Join Date
    Sep 2003
    Location
    KY
    Posts
    146

    I

    I am assuming for Transactional Replication, minimum requirement is a unique index !

    Thanks for above query

  4. #4
    Join Date
    Jul 2002
    Location
    Village, MD
    Posts
    621
    BOL:

    Microsoft® SQL Server™ 2000 automatically creates unique indexes to enforce the uniqueness requirements of PRIMARY KEY and UNIQUE constraints.

    My query returns list of tables without PRIMARY KEY or UNIQUE constraints. Try it on your database.

    Former Kentuckian.

Posting Permissions

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