I have three columns named docDt , docDateTime and docTime .
Where as docDt contains only date part(eg. 2017-01-01 00:00:00:000) and docTime contains only time(eg. 1900-01-01 22:00:00:000)
Also i am storing combined docDt and docTime to docDateTime (ie. 2017-01-01 22:00:00:000)
I'm inserting new record to table dated docDt(2017-01-02 00:00:00:000) and docTime(1900-01-01 10:00:00:000) and also storing combined date and time(2017-01-02 10:00:00:000) docDateTime .
Now I need to fetch records greater than the mentioned 2017-01-01 22:00:00:000
I have tried using the following condition
CONVERT(varchar(8), STH.DocTime , 108) >= '22:00:00.000' and CONVERT(varchar(10), STH.DocDt , 120) >='2017-01-01' ORDER BY STH.DocDt
NOTE: for docTime by default date is 1900-01-01
EDIT: docDateTime only for reference we can't use that because it will be stored in mysql. where as doctime and docdt are stored in sqlserver
May I get any help.