if exists (select * from sysobjects where id = object_id('dbo.Domain_ins') and sysstat & 0xf = 8)
drop trigger dbo.Domain_ins
GO
CREATE TRIGGER Domain_ins ON dbo.Domain
FOR INSERT
AS
DECLARE
@DomainName varchar(100)
select @DomainName = DomainName from inserted
IF (SELECT COUNT(Domain.DomainID) FROM Domain, inserted WHERE Domain.DomainName = inserted.DomainName
AND (Domain.Status > 100 OR Domain.Status = 87 OR Domain.Status = 97)) > 1
BEGIN
ROLLBACK TRANSACTION
Raiserror ("Duplicated Domain Name: %s", 16, 1, @DomainName)
END
GO
부탁드립니다. 급해서 그렇습니다.
|