I have a table with multiple records:
- User_Name ( e.g. ‘TOM’)
- Question_ID (eg ‘q002’)
- Answer (e.g. ‘D’)
i want to create a trigger so that no one can submit an answer to the same question twice.
It has to be a trigger only.
CREATE TRIGGER trigger_Check_Duplicates
ON submit_Answer
FOR INSERT
AS
IF SELECT???
PRINT 'duplicate'
raiserror('cant submit answer to same question twice')
ROLLBACK
End
Create trigger