Click here to Skip to main content
15,881,801 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have two column DATE,TIME in one table. I want to fetch record between 10/10/2013 10:10 - 10/12/2013 12:00. Tell me how to fetch.
Posted

Check this out:

Date Time selection in sql server.[^]

hope it helps :)
 
Share this answer
 
Comments
Abhilask kumar 26-Dec-13 4:12am    
It is not my question. first you understand my query.
my query is one table 2 column(DATE,TIME). Then How to select between two date and start time of start date and end time of end date.
 
Share this answer
 
Comments
Abhilask kumar 26-Dec-13 4:12am    
It is not my question. first you understand my query.
my query is one table 2 column(DATE,TIME). Then How to select between two date and start time of start date and end time of end date.
You can just add them.

select * from mytable where date + time >= '10/10/2013 10:10:00' and date + time <= '10/12/2013 12:00:00'
 
Share this answer
 
Comments
Abhilask kumar 26-Dec-13 5:27am    
It is return error "Operand data type date is invalid for add operator."
can i use SELECT * FROM mytable WHERE DATE+TIME between '2013-12-24 00:00:00' AND '2013-12-26 10:00:00'
Abhilask kumar 26-Dec-13 5:44am    
Thanks. I have cast date and time then work fine.
Christian Graus 26-Dec-13 18:04pm    
Awesome. I am pleased to hear that you worked at it and solved the issue.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900