You can acieve that using
Common Table Expressions[
^]:
Create procedure Select_Disurbment_Dates
@inputDate DATETIME
AS
BEGIN
;WITH Next3Days AS
(
SELECT @inputDate AS MyDate, 0 AS Counter
UNION ALL
SELECT DATEADD(dd,1,MyDate), Counter+1 AS Counter
FROM Next3Days
WHERE COunter<3
)
SELECT CONVERT(VARCHAR(10),MyDate,121) AS MyDate, Counter
FROM Next3Days
WHERE Counter>0
END
Result:
2013-08-22 1
2013-08-23 2
2013-08-24 3
Or use
while[
^] loop and temporary table ;)