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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:01:21+00:00 2026-05-27T03:01:21+00:00

Question: How can I detect which rows have lastModifiedDate < boundary at 30s/minute <

  • 0

Question:

How can I detect which rows have lastModifiedDate < boundary at 30s/minute < approvedDate
in T-SQL?

Background:

We have a regular process (Autonomy’s ODBCConnector product) which scans a view in our database, and picks up news articles which have changed since it last ran, based on the lastModifiedDate field.
This happens every thirty seconds, on the minute and at 30s after the minute.

There was a bug in this process, in that one of the operations was to approve these articles, and that did not cause the lastModifiedDate to change, but changed the approvedDate instead.

So, any article which was modified, picked up, and then approved, will not show up.

This will always be true for articles where approvedDate >= DATEADD(second, 30, lastModifiedDate) – but that does not pick up all of the articles which still need to be picked up. An article could have a lastModifiedDate of 28/11/2011 15:48:13 and an approvedDate of 28/11/2011 15:48:31 and not be picked up by the process.

NB the approvedDate is not necessarily more recent than the lastModifiedDate

  • 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-27T03:01:22+00:00Added an answer on May 27, 2026 at 3:01 am

    Do you mean you want all records where the approvedDate is in the next 30s block of time relative to the 30s block of time that the lastModifiedDate is in?

    LastModifiedDate | ApprovedDate | Include In Results?
    00:00:00         | 00:00:00     | No
    00:00:00         | 00:00:29     | No
    00:00:00         | 00:00:30     | Yes
    00:00:00         | 00:00:31     | Yes
    00:00:00         | 00:01:01     | No?
    00:00:29         | 00:00:29     | No
    00:00:29         | 00:00:30     | Yes
    00:00:29         | 00:00:31     | Yes
    00:00:29         | 00:01:01     | No?
    

    If so, try this?

    WHERE
      DATEDIFF(second, 0, ApprovedDate    ) / 30
      =
      DATEDIFF(second, 0, LastModifiedDate) / 30 + 1
    

    In No? should be Yes in the original table I gave, try this?

    WHERE
      DATEDIFF(second, 0, ApprovedDate    ) / 30
      >
      DATEDIFF(second, 0, LastModifiedDate) / 30
    

    Or, perhaps…

    WHERE
      ApprovedDate
      >=
      DATEADD(second, 30 - DATEDIFF(second, 0, LastModifiedDate) % 30, lastModifiedDate)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can i detect external link click? I have a simple question, which may
I cannot find a simple example about my question above: how can i detect
this question can create a misunderstanding: I know I have to use CSS to
My original question can be found here , for which I've gotten some great
Question: How can I detect and handle clicks on hyperlinks in a Windows.Forms.WebBrowser control
I have some code which returns InnerXML for a XMLNode. The node can contain
Background: I have a website, which we'll call AwesomeSite.com; it handles all of my
I wanted to know how to detect which edition of SQL Server 2008 is
I have a question that might seem basic but can't figure it out. Basic
Question Can I build a image database/library that has an e-commerce style checkout system

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.