msg 4104

  • CREATE

    TRIGGER 1_trig ON option

    AFTER

    INSERT , UPDATE

    As

    update option

    set pr.ID = o.ProvinceID

    from option o , Provinces pr

    where pr.postal = o.state

     

    is this script have any  syantax errors

    this gave  error

    Msg 4104, Level 16, State 1, Line 2

    The multi-part identifier "pr.ID" could not be bound.

    pls help

     

  • This was removed by the editor as SPAM

  • Well, for starters, your UPDATE statement states that you are updating table option, but the SET clause is assigning a value in the providence table.  Which table and value are you attempting to update?  If your intention was to update the providence table, try this:

    CREATE TRIGGER trig ON [option] AFTER INSERT , UPDATE

    AS

    BEGIN

        UPDATE pr

        SET pr.ID = o.ProvinceID

        FROM [option] o

            INNER JOIN Provinces pr

            ON pr.postal = o.state

    END

     

    John Rowan

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

  • Are you trying to update option table or Provinces table. Cos ur statement is trying to update a column in "Provision" table while ur update statement says "Update Option" table.

     

  • thnks  for suggestion

Viewing 5 posts - 1 through 4 (of 4 total)

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