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 8053913
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T08:00:28+00:00 2026-06-05T08:00:28+00:00

How can I control that only specific columns of a table will be updated?

  • 0

How can I control that only specific columns of a table will be updated?

My method is : create instead of update trigger for these tables and control for update only updatable columns and if updated, non updatable column raise error with an appropriate message.

  • 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-06-05T08:00:30+00:00Added an answer on June 5, 2026 at 8:00 am

    Yes you can use triggers to achieve that but don’t use INSTEAD OF trigger.
    You can better use FOR UPDATE triggers because you don’t have to rewrite the whole update query. You only want to deny not allowed updates. If an action is allowed you don’t throw an error so the data will be updates as usual.

    Example:

    CREATE TRIGGER [dbo].[CheckUpdate] ON [dbo].[MyTable] FOR UPDATE AS
    
    DECLARE @EXPECTED INT = (SELECT COUNT(0) FROM INSERTED)
    DECLARE @ALLOWED INT = (
       SELECT COUNT(0)
       FROM INSERTED i 
       INNER JOIN DELETED d 
       ON i.Id = d.Id
       WHERE i.Name = d.Name -- The readonly column
    ) 
    
    IF(@EXPECTED <> @ALLOWED) -- True if there are not allowed records to updated
    BEGIN
        -- Prevent the record will be updated
        RAISERROR ('Readonly columns cannot be changed',11, 1);
        ROLLBACK
    END
    --Do nothing in the ELSE because everything seems to be OK
    --(the record will be updated)
    

    You also can make use of Stored Procedures to control the update of certain tables.

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

Sidebar

Related Questions

I am designing a control that can have two main states. The state will
I need a control that can list data in 3 columns, I want to
I need a button-like control that can have a Checked property, so that when
I'm making a custom control that can be dragged around and it is semi
I have a custom control that can be added multiple times to a form.
I have an eeprom that I control with a php script. I can control
I'm looking for something like the Windows Media Player control that can be hosted
I am looking for a third-party open source or commercial WinForms control that can
How can I go about creating a control that has items in item that
I have a custom control that inherits from UserControl , and I can't get

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.