Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7689239
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:07:06+00:00 2026-05-31T20:07:06+00:00

This is what I have. It looks like MS’s example adn I can’t figure

  • 0

This is what I have. It looks like MS’s example adn I can’t figure out why it’s not running. I get an Invaild column name ‘PlanID’ error on this line:

WHERE gm.PlanId = i.[PlandID]

I was under the impression INSERTED would contain the same fields as the Plan table. Maybe I’m way off – this is my first trigger!

PlanID is the primary key in the Plan table and is a foreign key to Measures. I’m basically looking to check when a row in Plan’s Status field is updated and then update the Status field in Measures.

CREATE TRIGGER utr_Plan_Cascade_Status
   ON  [dbo].[Plan]
   for UPDATE
AS 
BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON;

    IF(UPDATE([Status]))
    BEGIN
        UPDATE dbo.Measures
            SET [Status]= i.[Status]
        FROM dbo.Measures m, INSERTED i, DELETED d
            WHERE m.PlanId = i.[PlandID]

    END

END

Any help will be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T20:07:07+00:00Added an answer on May 31, 2026 at 8:07 pm

    Why are you using old style joins?

    You also don’t need the deleted table at all.

    This should work for you

     UPDATE m
                SET m.[Status]= i.[Status]
            FROM dbo.Measures m
            JOIN INSERTED i ON m.PlanId = i.[PlandID]
    

    Just as a FYI..IF(UPDATE([Status])) will fire if you do the following

    Update Table set Status = Status
    

    perhaps you want to add where m.Status <> i.Status to your WHERE clause

    Also keep in mind that if that column is nullable you need to account for that in this where clause

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have something that looks like this: As you can see, Blambo is a
Currently I am doing this: I have text that looks like: Hello ${user.name}, this
I have this mysql table called comments which looks like this: commentID parentID type
I have data that looks like this: entities id name 1 Apple 2 Orange
I have code that looks like this: template<class T> class list { public: class
I have XML that looks like this: <Parameter Name=parameter name Value=parameter value /> which
I have XML that looks like this: <ROW ref=0005631 type=04 line=1 value=Australia/> <ROW ref=0005631
I have template that looks like this: 100 template<size_t A0, size_t A1, size_t A2,
I have data that looks like this: #info #info2 1:SRX004541 Submitter: UT-MGS, UT-MGS Study:
I have code that looks like this: class T {}; class container { const

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.