Why do you have to loop? What is the requirement that states you have to process a single day at a time?
FWIW, you could build a stored procedure that accepts as input the date you want to search, and query for everything on that one date. Example:
CREATE PROCEDURE dbo.MySingleDaySearch
DECLARE @startDate datetime;
DECLARE @endDate datetime;
SET @startDate = dateadd(day, datediff(day, 0, @inputDate), 0); -- remove time portion
SET @endDate = dateadd(day, 1, @startDate); -- set the end date to tomorrow
FROM dbo.MyTable t
WHERE t.MyDateColumn >= @startDate
AND t.MyDateColumn < @endDate;
But, I gotta say that running this for a full month by 'looping' on each date is not the right way to solve the problem. If you posted the problem you are trying to solve - it might be easier for us to recommend a better solution than looping.
Problems are opportunities brilliantly disguised as insurmountable obstacles.
How to post questions to get better answers faster
Managing Transaction Logs