Query that returns data that is staggered

Posted on 2006-04-20
Last Modified: 2012-05-05
I have a database that has 50,000 records from a remote field device. These readings are every 16 seconds, and are stored as such in the database. What I am wondering is if there is a query that I can do that will return the reading at every hour? I am currently running the query with the device ID, and getting all readings. The column for date and time is the datetime format.


Question by:bradbritton
    LVL 75

    Accepted Solution

    reading during last hour

    WHERE DATEDIFF(hh,urDateTimeColumn,GETDATE()) = 1
    LVL 20

    Expert Comment

    You can create a job with your query and schedule it to run every one hour.
    LVL 17

    Expert Comment

    Try to use "WAITFOR DELAY"


    while 1<>2
     WAITFOR DELAY '00:01:00'
     --quey here

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
    Introduction In my previous article ( I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
    Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
    Via a live example, show how to setup several different housekeeping processes for a SQL Server.

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now