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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T20:21:59+00:00 2026-05-10T20:21:59+00:00

I hope this is a simple enough question for any SQL people out there…

  • 0

I hope this is a simple enough question for any SQL people out there…

We have a table which hold system configuration data, and this is tied to a history table via triggers so we can track who changed what, and when.

I have a requirement to add another value in to this table, but it is one that will change frequently from code, and has a requirement that we don’t track it’s history (we don’t want to clog the table with many thousands of updates per day.

At present, our trigger is a little like this…

CREATE TRIGGER      [dbo].[SystemParameterInsertUpdate] ON      [dbo].[SystemParameter] FOR INSERT, UPDATE  AS   BEGIN     SET NOCOUNT ON       INSERT INTO SystemParameterHistory        (         Attribute,         ParameterValue,         ParameterDescription,         ChangeDate       )     SELECT       Attribute,       ParameterValue,       ParameterDescription,       ChangeDate     FROM Inserted AS I END 

I’d like to be able to add some logic to stop it creating the record if an Attribute colum value is prefixed with a specific string (e.g. ‘NoHist_’)

Given that I have almost no experience working with triggers, I was wondering how it would be best to implement this… I have tried a where clause like the following

where I.Attribute NOT LIKE 'NoHist_%' 

but it doesn’t seem to work. The value is still copied over into the history table.

Any help you could offer would be appreciated.


OK – as predicted by Cade Roux, this fail spectacularly on multiple updates. I’m going to have to take a new approach to this. Does anyone have any other suggestions, please?


Guys – Please educate me here… Why would LEFT() be preferable to LIKE in this scenario? I know I’ve accepted the answer, but I’d like to know for my own education.

  • 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. 2026-05-10T20:21:59+00:00Added an answer on May 10, 2026 at 8:21 pm

    Given that a WHERE clause did not work, maybe this will:

    CREATE TRIGGER      [dbo].[SystemParameterInsertUpdate] ON      [dbo].[SystemParameter] FOR INSERT, UPDATE  AS   BEGIN     SET NOCOUNT ON        If (SELECT Attribute FROM INSERTED) LIKE 'NoHist_%'       Begin           Return       End        INSERT INTO SystemParameterHistory        (         Attribute,         ParameterValue,         ParameterDescription,         ChangeDate       )     SELECT       Attribute,       ParameterValue,       ParameterDescription,       ChangeDate     FROM Inserted AS I END 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 58k
  • Answers 58k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer The -mno-cygwin flag removes all dependencies on Cygwin so that… May 11, 2026 at 8:43 am
  • added an answer You need to look at Context Switching under the Action… May 11, 2026 at 8:43 am
  • added an answer The bottom line is there is no 100% reliable way… May 11, 2026 at 8:43 am

Top Members

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

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.