Click here to Skip to main content
15,889,488 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I have time fields with datetime datatypes ie. From & To

I inserted values for that as follows.

1 Breakfast 2012-04-05 07:00:00.000 2012-04-05 10:00:00.000
1 Lunch 2012-04-05 11:00:00.000 2012-04-05 02:30:00.000


I need to prepare storedprocedure for following..
Input parameter: user will pass the time as input ie 8AM, 1PM

Output : i need to retrieve all values to the user.

How can i compare this input time to Database time?

Thanks in Advance
Posted

1 solution

Try:
SQL
DECLARE @TIME TIME = '11PM'
SELECT * FROM myTable WHERE CONVERT(time, myDateColumn)>=@TIME
 
Share this answer
 

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