TSQL, How to get smalldatetime's time between two smalldatetime's times ?

Posted by eugeneK on Stack Overflow See other posts from Stack Overflow or by eugeneK
Published on 2010-06-16T08:18:47Z Indexed on 2010/06/16 8:22 UTC
Read the original article Hit count: 224

Filed under:
|
|

I have Table with two smalldatetime columns, where one is startTime and other one is endTime. I need to select all values from table which between times of both columns compared to getdate()' time.

I'm using SQL-Server 2005.

example

  • startDate endDate value1
  • 2/2/01 16:00 2/2/01 18:00 1
  • 2/2/01 21:00 2/2/01 22:00 2
  • 2/2/01 05:00 2/2/01 22:00 3

getdate() gives 2/2/2000 21:40

so i need to get value1 2 and 3

thanks in advance

© Stack Overflow or respective owner

Related posts about sql

Related posts about sql-server-2005