Query to list all the primary and unique keys

  • Just curious if anyone has a query to list all the primary and unique keys in a SQL server 2000 database?

    Thanks.

  • SELECT * FROM dbo.sysobjects WHERE XType IN ('PK', 'UQ')

    Please note that there's a difference between unique constraint and unique index. UI won't be in the objects table.

    Re-edit 18K 🙂

Viewing 2 posts - 1 through 1 (of 1 total)

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