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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T01:09:34+00:00 2026-05-11T01:09:34+00:00

Suppose I have a database table that has a timedate column of the last

  • 0

Suppose I have a database table that has a timedate column of the last time it was updated or inserted. Which would be preferable:

  1. Have a trigger update the field.
  2. Have the program that’s doing the insertion/update set the field.

The first option seems to be the easiest since I don’t even have to recompile to do it, but that’s not really a huge deal. Other than that, I’m having trouble thinking of any reasons to do one over the other. Any suggestions?

  • 1 1 Answer
  • 1 View
  • 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-11T01:09:34+00:00Added an answer on May 11, 2026 at 1:09 am

    The first option can be more robust because the database will be maintaining the field. This comes with the possible overhead of using triggers.

    If you could have other apps writing to this table in the future, via their own interfaces, I’d go with a trigger so you’re not repeating that logic anywhere else.

    If your app is pretty much it, or any other apps would access the database through the same datalayer, then I’d avoid that nightmare that triggers can induce and put the logic directly in your datalayer (SQL, ORM, stored procs, etc.).

    Of course you’d have to make sure your time-source (your app, your users’ pcs, your SQL server) is accurate in either case.


    Regarding why I don’t like triggers:

    Perhaps I was rash by calling them a nightmare. Like everything else, they are appropriate in moderation. If you use them for very simple things like this, I could get on board.

    It’s when the trigger code gets complex (and expensive) that triggers start to cause lots of problems. They are a hidden tax on every insert/update/delete query you execute (depending on the type of trigger). If that tax is acceptable then they can be the right tool for the job.

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

Sidebar

Related Questions

Suppose I have following table in my database: Tbl_Persons: Id Country Name 1 Australia
Suppose we have 2 tables, a and b: CREATE TABLE a (id_a INT NOT
We have an application that uses Windows authentication to authenticate users with the database,
Suppose you have a fixed list of values (strings): None, Skype, ICQ, GoogleTalk, MSN
suppose I have simple C# code to print HELLO WORLD as shown in here
I am using a 3rd-party rotator object, which is providing a smooth, random rotation
We have a web-app for tracking periodic payments for a loan, currently we are
I am new to django so i am little bit confused with database syncing.
I am experiencing a very strange issue with custom conflict handling using the Sync
I am getting confused with my code and not sure how to implement what

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.