Question : SQL DATETIME Compare HELP



Hello Experts,

I am trying to fetch all records created after or equal to a specific record create date. I am using following query but it is not giving me correct results .I am only interested in compareing dates till hours and not beyond that.
Please let me know how should I rewrite query to get desired result

Thanks
Select *
From Master tm
Where
tm.CreateDate >= (Select CreateDate From Master Where MasterID = @MasterId)

Answer : SQL DATETIME Compare HELP

If I am correct, please try this:
1:
2:
3:
4:
5:
6:
7:
8:
Select *
From Master tm
Where
tm.CreateDate >= (
	Select DATEADD(hour, DATEPART(hour, CreateDate), DATEDIFF(day, 0, CreateDate)) 
	From Master 
	Where MasterID = @MasterId
)
Open in New Window Select All
Random Solutions  
 
programming4us programming4us