compare times with sql

I need to find all the rows in my data base that have a timestamp within the last 30 seconds.  One of my columns contains a timestamp in this format 12/13/2011 9:42:27 AM.  I need to find all rows that have a time stamp within the last 30 seconds.  How can I do this with an sql command?
chadmanvbAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CodeCruiserCommented:
Select * From tablename where DateDiff(second, datetimecolumne, getdate()) <= 30
0
chadmanvbAuthor Commented:
I'm getting a conversion failed when  converting time to char string.  Here is the query im using.

Select * From dbo.Workstations where DateDiff(second, CHECKTIME, getdate()) <= 30

The time in i have in my cell is in the following format.  12/13/2011 9:42:27 AM
0
Exploring SharePoint 2016

Explore SharePoint 2016, the web-based, collaborative platform that integrates with Microsoft Office to provide intranets, secure document management, and collaboration so you can develop your online and offline capabilities.

sybeCommented:
I have you haven't stored the timestamp in a text field, but that is what it looks like.
0
chadmanvbAuthor Commented:
Well I found that a bunch of them did not have a time stamp yet, so I changed the query to just look at one row, but I'm not sure of the syntax.  Here is what I have, but it's not right.  I just want it to check one row

Select * From dbo.Workstations where DateDiff(second, CHECKTIME, getdate()) <= 30, SERIAL=234454345
0
CodeCruiserCommented:
Try

Select * From dbo.Workstations where DateDiff(second, CHECKTIME, getdate()) <= 30 AND SERIAL=234454345
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
chadmanvbAuthor Commented:
Worked great!  Thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.