error with Code!! please advise!!!

  • 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

  • Well, what's the error?

    John Rowan

    ======================================================
    ======================================================
    Forum Etiquette: How to post data/code on a forum to get the best help[/url] - by Jeff Moden

  • 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


    And then again, I might be wrong ...
    David Webb

  • 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