I'm preventing the user from adding the same surname in the list in the code array below. But my goal is to check all the lines using the 'trigger'. As a result: what do I need to do to check all the columns? In summary: Check all columns. If the same value is entered, prevent it from being added.
ALTER TRIGGER trigger_example
ON dbo.information
INSTEAD OF INSERT
AS
DECLARE @surname varchar(30)
select @surname = Person_Job FROM inserted
IF(@surname = 'Enderson')
BEGIN
PRINT 'The person with this record already exists in the list.'
END
ELSE
BEGIN
INSERT INTO personel.dbo.information(Person_id,Person_FirstName,Person_LastName,Person_Salary,Person_Job)
SELECT Person_id,Person_FirstName,Person_LastName,Person_Salary,Person_Job FROM inserted
END
GO