SQL Query for Time Filed

10 pts.
Tags:
SQL Query
SQL Server 2005
SQL tables
I have a sql table where the field tr_time contains the trade time and datatype of the filed is Datetime. I want to retrieve records where the time is in multiple of 5 seconds, so records where the seconds are in multiple of 5 only. How can I do this?

Answer Wiki

Thanks. We'll let you know when a new response is added.

Try this
<pre>select * from table
where DATEPART(ss, trade_time)%5 = 0</pre>

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: