Tag Info

New answers tagged

0

SELECT * FROM foos INNER JOIN ( SELECT name FROM foos GROUP BY name HAVING COUNT(*) > 1 ) AS dup ON foos.name = dup.name ORDER BY name


3

Assuming the following table definition CREATE TABLE T ( Name VARCHAR(50) NOT NULL, IsDeleted BIT NOT NULL ) Then you can achieve this with a unique index filtered to only include those Names that you wish to apply the constraint on. CREATE UNIQUE INDEX ix ON T(Name) WHERE IsDeleted = 'false'



Top 50 recent answers are included