troubleshooting Question

How to Extract the Time in ms sql server

Avatar of nrajasekhar7
nrajasekhar7 asked on
Microsoft SQL ServerMicrosoft SQL Server 2005Microsoft SQL Server 2008
16 Comments1 Solution355 ViewsLast Modified:

 i am having   a column  called timestamp: i have data for every mintue:
i need to extract the five mintue data:
in oracle  i use :
select (concat(concat(to_char(timestamp,'HH24:MI'),' - '), (select to_char(timestamp +(ROWNUM* 5/1440), 'HH24:MI') from dual))) as timestamp .... so on the query

what command should i use in   ms sql server:
to get the outout below: please help:

2008-03-14 10:49:00
2008-03-14 10:48:00
2008-03-14 10:47:00
2008-03-14 10:46:00
2008-03-14 10:45:00
2008-03-14 10:44:00

out put should be like these:
11:27 - 11:32 (5 minute)
12:52 - 12:57
13:01 - 13:06
13:50 - 13:55
10:32 - 10:37
10:52 - 10:57


Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 16 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 16 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros