• I tried this...

    if exists(select email from user where

    email LIKE '%@hotmail%' or

    email LIKE '%@gmail%' or

    email LIKE '%@googlemail%' or

    email LIKE '%@yahoo%')

    insert into userprofile(userID, fieldID, value, primaryVal, levelID)

    select userID, 5001, 'external', 0, NULL

    from user ju

    where not exists (select userID from userprofile where userID = ju.userID

    and fieldID = '5001')

    Although the script does not create a duplicate row, it update every other user in the table i.e. with an email address like @bbc.co.uk.