Hot answers tagged

4 votes
Accepted

Make two columns unique both ways

With 2 unique constraints you can achieve the desired restriction : create unique index on match (round, least(home, away)); create unique index on match (round, greatest(home, away)); Check the ...
  • 2,237
3 votes
Accepted

If checking while deleting the record meets the requirements, I do want to delete it

In an INSTEAD trigger you need to DELETE your records also, as the trigger goes instead of the delete action. See example below: CREATE TRIGGER MyTable_Trigger_Delete ON dbo.MyTable INSTEAD OF DELETE ...
  • 825
2 votes
Accepted

After Insert Trigger not working in Sql Server

The problem is this SELECT statement: Select ProjectId,EnteredBy,CODINGRATE,REVIEWRATE,CodingTimeInMin,ReviewedTimeInMin,DocCoded,DocReviewed ,DocCorrected, PerDocCorrected,LastModified From #CTE7; ...
  • 25.5k
1 vote

Make two columns unique both ways

You can use a trigger to enforce this constraint. The trigger should check if the club has already played in the same round, and if so, prevent the insert from happening. Here's an example of how the ...
1 vote
Accepted

Running a sequential trigger

You can use the system stored procedure sp_settriggerorder to set the first and last AFTER triggers to be run on a table. As per the docs on Triggers: You can specify only one first and one last ...
  • 28.7k

Only top scored, non community-wiki answers of a minimum length are eligible