Reputation: 4435
I want my table to have unique rows, but not unique columns. Is that an option? I want to be able to have same values on multiple rows in the same column, but not a 100% copy of another row...
I saw this question but it is about MySQL, and I need it for SQL SERVER.
My specific table (conversation-staffer) is this:
conversation_id | staffer_id | handled
Thanks.
Upvotes: 1
Views: 1886
Reputation: 31879
You could add a unique index that includes all the columns of the table:
CREATE UNIQUE INDEX <index name> ON <tablename>(<columns>);
Alternatively, you could set all columns as your Primary Key. But you have to drop the PK
first if the table already has.
ALTER TABLE <tablename> DROP CONSTRAINT <constraint_name>;
ALTER TABLE <tablename> ADD PRIMARY KEY (<columns>);
Upvotes: 4