| Author |
Topic |
|
Maverick_
Posting Yak Master
107 Posts |
Posted - 2010-08-16 : 04:37:00
|
Hi allI am trying to enter a time condition as part of my SQL statement below. I can get the date to work but I am trying to enter a specific time for >= and <= (i.e. something like 13:05:59 and 23:59:59) but it doesn't seem to work.Any tips on how to enter time condition along with the date? I tried googling for the format but they did not work so I asked SELECT ce.enquiry_number, ce.logged_date, ce.outstanding_flag, enquiry_status.enq_status_name, ao.officer_name, enquiry.site_code, enquiry.plot_numberFROM ce, enquiry_status, ao, enquiryWHERE ce.enq_status_code = enquiry_status.enq_status_code AND ao.officer_code = ce.officer_code AND ce.enquiry_number = enquiry.enquiry_number AND ce.logged_date >= '20061201' AND ce.logged_date <= '20061231' |
|
|
vaibhavktiwari83
Aged Yak Warrior
843 Posts |
Posted - 2010-08-16 : 04:45:46
|
| Why cant you use date and time combinely like '20061201 23:59:59' ?Vaibhav TTo walk FAST walk ALONE To walk FAR walk TOGETHER |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2010-08-16 : 04:57:34
|
Always use open-ended datetime searches!SELECT * FROM Table1WHERE DateTimeColumn >= '20061201' AND DateTimeColumn < '20070101'This is how you avoid ANY problem regarding the time part. N 56°04'39.26"E 12°55'05.63" |
 |
|
|
Maverick_
Posting Yak Master
107 Posts |
Posted - 2010-08-16 : 05:31:24
|
quote: Originally posted by vaibhavktiwari83 Why cant you use date and time combinely like '20061201 23:59:59' ?Vaibhav TTo walk FAST walk ALONE To walk FAR walk TOGETHER
This was exactly what I was looking for. Cheers! |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2010-08-16 : 05:32:45
|
I hope you are joking. N 56°04'39.26"E 12°55'05.63" |
 |
|
|
vaibhavktiwari83
Aged Yak Warrior
843 Posts |
Posted - 2010-08-16 : 06:51:33
|
quote: Originally posted by Peso I hope you are joking. N 56°04'39.26"E 12°55'05.63"
Agreed with you... Vaibhav TTo walk FAST walk ALONE To walk FAR walk TOGETHER |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-08-16 : 10:50:29
|
quote: Originally posted by Maverick_
quote: Originally posted by vaibhavktiwari83 Why cant you use date and time combinely like '20061201 23:59:59' ?Vaibhav TTo walk FAST walk ALONE To walk FAR walk TOGETHER
This was exactly what I was looking for. Cheers! 
are you looking at data between two dates with exact time part?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-08-17 : 02:56:12
|
quote: Originally posted by vaibhavktiwari83 Why cant you use date and time combinely like '20061201 23:59:59' ?Vaibhav TTo walk FAST walk ALONE To walk FAR walk TOGETHER
Becuase it will not bring all data of date 20061201MadhivananFailing to plan is Planning to fail |
 |
|
|
vaibhavktiwari83
Aged Yak Warrior
843 Posts |
Posted - 2010-08-17 : 03:06:37
|
quote: Originally posted by madhivanan
quote: Originally posted by vaibhavktiwari83 Why cant you use date and time combinely like '20061201 23:59:59' ?Vaibhav TTo walk FAST walk ALONE To walk FAR walk TOGETHER
Becuase it will not bring all data of date 20061201MadhivananFailing to plan is Planning to fail
Even he did not want all the data of the date 20061201see his original post"I can get the date to work but I am trying to enter a specific time for >= and <= (i.e. something like 13:05:59 and 23:59:59)"Vaibhav TTo walk FAST walk ALONE To walk FAR walk TOGETHER |
 |
|
|
|