March 10, 2004 at 7:18 am
How do I do the following?
1) Do I put the 0700 in quotes or not?
...DATEPART(hh,@start_date_time) >= '0700'
2) I want to change the time portion of the @start_date_time var to 0700?
March 10, 2004 at 7:32 am
What do you want to do ?
datepart(hh,**) will only return hours-part.
Datepart(mi,..) will only return minutes-part.
why not compare to convert(datetime, convert(char(10),getdate(),121) + ' 07:00:00'))
from Books Online :
Returns an integer representing the specified datepart of the specified date.
DATEPART ( datepart , date )
Johan
Learn to play, play to learn !
Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere :w00t:
- How to post Performance Problems
- How to post data/code to get the best help[/url]
- How to prevent a sore throat after hours of presenting ppt
press F1 for solution, press shift+F1 for urgent solution 😀
Need a bit of Powershell? How about this
Who am I ? Sometimes this is me but most of the time this is me
March 10, 2004 at 9:07 am
Rob,
what does '0700' refer to in your SQL Query? I mean what part of the date?
Prasad Bhogadi
www.inforaise.com
March 11, 2004 at 9:48 am
'0700' seems 7AM to me. If yes, DATEPART(hh, @start_date_time) >= 7 may answer Q1. With regard to Q2, if you'd like to retrieve 'hh00' out of a datetime field, you may do something like RIGHT('0' + DATEPART(hh, @start_date_time) + '00', 4).
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply