Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
stumbling
Posting Yak Master
104 Posts |
Posted - 2009-03-22 : 17:35:43
|
Hi AllI have a table with 5 basic columns in it for eventsStart Date Start Time End Time End Date EVENTid23/03/2009 09:00AM 2:30PM 23/03/2009 123423/03/2009 10:00AM 12:01AM 25/03/2009 12345What i need to do is select the start time where the End Time is less than the current time on todays date. I can get my code to work if the End Date is today but not if it is in the future, and the more i play with it the worse i get (LOL).Any help would be appreciated.Select "START TIME" from TableWhere Cast("End Time" as DateTime) >= Cast(LTRIM(RIGHT(CONVERT(VARCHAR(20),Getdate(), 0), 7))as DateTime) |
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2009-03-23 : 00:22:26
|
try this onceSelect STARTTIME from Tablewhere cast(endtime as datetime) <= cast(convert(varchar(15) ,getdate(),108) as datetime) |
|
|
stumbling
Posting Yak Master
104 Posts |
Posted - 2009-03-24 : 18:22:27
|
Thanks for that i wil lgive it a go. Cheers Phil |
|
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2009-03-24 : 22:36:23
|
welcome |
|
|
|
|
|