Anyone know how to search for records two hours long

  • I need to run a script to check any open transactions on the database for the last 2 hours. The application has a column called flag set to 'C' when performing updates and inserts that is set to 'N' on completion of a transaction. However, I found some transactions are remaining flagged as 'C' (in limbo land) and I want to know as soon it happens.

    I could use the datepart function to build something up but I was hoping someone out there had written something that would perform much better.


    ------------------------------
    The Users are always right - when I'm not wrong!

  • I could have phrased the question a little better me thinks.

    I was able to come up with a solution:

    I use the

    select * from mytable where datediff(mi,create_datetime,getdate()) < 120

    I thought that one og the real techies out there would be able to answer this. I am very disappointed in you all. Tsh tsh.


    ------------------------------
    The Users are always right - when I'm not wrong!

  • Sorry, too busy to do much in the forums yesterday.

    Glad you came up with the answer.

  • Ha, I dont even get to work till noon, sorry but most of my reading and answering takes place during the late evenings...

    Place a question at 10:00 PM, I'll respond within the hour or not, I look for the more Challenging Questions...


    Regards,

    Coach James

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply