Why not a WHERE clause? Sounds like you're getting the records one at a time?
Exactly i want to get all the data's. That'y i use loop through.
Here in table my StartDate can be From and To date is one and the same. For ex, if i run the script today, My From and To Date
can be today. If i run my Script tomorrow my From and To Date
can be tomorrow.
Exactly my script is like this.
DECLARE @StartDate DATETIME,@LEndDate DATETIME,@EndDate DATETIME
@StartDate = '2010-10-02'
@LEndDate = '2010-10-05'
WHILE @StartDate <= @LEndDate
BEGIN
SET @StartDate = @StartDate
SET @EndDate = @StartDate
<Insert Statement>
<SELECT Statement WHERE FromDate = @StartDate AND ToDate = @EndDate>
<Calculation Part>
SET @StartDate = @StartDate + 1
END
<SELECT ST>