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

  • Home
  • SEARCH
  • 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 6366545
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:26:06+00:00 2026-05-25T00:26:06+00:00

Is there a way, using a trigger or some other means, to ensure that

  • 0

Is there a way, using a trigger or some other means, to ensure that a particular field is always explicitly set when a row is updated, even when running ad hoc SQL via SQL Server Management Studio? Specifically, our tables all have change_note fields, and we always want that field to be set for every update. Things we’ve considered and discarded:

  1. Set change_note to NOT NULL. We do this, but it doesn’t help. Once change_note has an initial value, you can run as many UPDATE statements as you want that forget to update change_note and NOT NULL remains happy because the previous value is still sitting in change_note.

  2. Use a trigger to compare the old version of change_note to the new value of change_note. Sometimes you want change_note to be the same as it was previously. It’s not that we want to ensure that change_note changes, we want to ensure that a value for it is explicitly provided in any update.

  3. Deny permissions for running ad hoc SQL and force everybody to only update data through our stored procedure API, and make change_note a required param for all SPs that update the relevant tables. We have too many ad hoc querying needs for this.

Stumped! Any ideas?

Thanks!

  • 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-25T00:26:07+00:00Added an answer on May 25, 2026 at 12:26 am

    You can use the Update() function within the trigger body. It will check if the statement which fired the trigger tried to change the value on the column:

    if Update(column)
        --do whay you want;BEGIN....END;
    

    You can find more information about it in:

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

    http://msdn.microsoft.com/en-us/library/aa258254(v=sql.80).aspx

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

Sidebar

Related Questions

Is there a way using Core Audio on OS X to extract a set
Is there a way using JNI and C# code to create a program that
I'm building some objects that will trigger custom events, and I'm using jQuery's bind
Is there a way to create mysql triggers using Activerecord migrations ? Has anybody
Is there a way using the iPhone SDK to get WiFi information? Things like
Is there a way using Java to over-ride the browser authentication dialog box when
Is there a way using Flash (CS3+AS3) to determine if the published swf is
Is there a way using SQL to list all foreign keys for a given
Is there a way using SWT to get a list of all processes currently
Is there a way using Subversion to get snapshot of the files for a

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.