June 29, 2006 at 11:58 am
ALTER trigger [dbo].[testinsert] on [dbo].[customer]
FOR INSERT
AS
if not EXISTS (SELECT email FROM contactinfo)
-- tying to check the new value is exist in the contactinfo if not then insert
begin
insert contactinfo(email, description)
select email,[desc] from inserted
end
June 29, 2006 at 12:19 pm
June 29, 2006 at 12:19 pm
How about ....
ALTER trigger [dbo].[testinsert] on [dbo].[customer]
FOR INSERT
AS
if not EXISTS
(SELECT c.email
FROM contactinfo c
join inserted i on c.email = i.email)
-- tying to check the new value is exist in the contactinfo if not then insert
begin
insert contactinfo(email, description)
select email,[desc] from inserted
end
June 29, 2006 at 12:29 pm
thanks. that worked!!!
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply