Trigger not working properly

  • This trigger is supposed to change the phone number to all 1s if the first 3 numbers in the phone falls in the IN criteria.  It's not doing that, instead it doesn't and also if the phone number is null, it updates that with all 1s also which is an undesired result

    ALTER Trigger [IT_Restrict_AreaCodes]

    ON [dbo].[DialEmpty]

    AFTER INSERT

    AS

    if @@rowcount = 0 return

    Update d set phonenum = '1111111111'

    From dialempty d join inserted i on d.DialID = i.DialID

    inner join project p on p.projectid = i.projectid

    Where Left (i.phonenum,3) IN (203,475,860,959,406,218,320,507,612,651,763,952)

    AND p.projecttype = 6

  • resolved;  I was simply missing the ending GO

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply