I am new to triggers

  • Create Trigger jam_spu_csp_insert

    on dbo.customer_special_prices

    After Insert referencing new as new_name for each row

    AS

    Begin

    Set nocount on;

    insert into jam_spu ( customer_id, location_number, seq_num )

    values ( new_name.customer_id, new_name.location_number, new_name.seq_num )

    end

    go

    ---error --

    Server: Msg 170, Level 15, State 1, Procedure jam_spu_csp_insert, Line 3

    Line 3: Incorrect syntax near 'referencing'.

    Server: Msg 128, Level 15, State 1, Procedure jam_spu_csp_insert, Line 8

    The name 'customer_id' is not permitted in this context. Only constants, expressions, or variables allowed here. Column names are not permitted.

  • Is that Oracle sytax? Someone can correct me if I'm wrong but I don't believe this is valid sytax "referencing new as new_name for each row". New to me if it is. Check out this link below. Might give you the information you need.

    http://msdn.microsoft.com/en-us/library/ms189799.aspx

  • This is actually a double-posted question. Answers already provided on another thread with the same question.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • No replies to this thread please. Direct replies to: http://www.sqlservercentral.com/Forums/Topic1235923-1292-1.aspx

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

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

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