how to add loop in date column in sql through query?
You can use a calendar table:




CREATE TABLE Calendar(cDate datetime, cDay int, cDayOfWeek int, cDayName varchar(20), cMonth int);

DECLARE @date date = '20180101';
WHILE @date &lt;= '20180131'
BEGIN
    INSERT INTO Calendar VALUES (@date, 
                                 DAY(@date), 
                                 DATEPART(weekday, @date), 
                                 DATENAME(weekday, @date),
                                 MONTH (@date));
    SET @date = DATEADD(day, 1, @date);
END


CREATE TABLE Mov (Day_no date, Balance int);
INSERT INTO Mov VALUES
('20180101', 5000),
('20180110', 10000),
('20180115', 12000);
GO



34 rows affected






SELECT cDAte, (SELECT TOP 1 Balance
               FROM   Mov
               WHERE  Day_no &lt;= cDate
               ORDER BY Day_no DESC) Balance
FROM   Calendar
WHERE cMonth = 1;
GO



cDAte               | Balance
:------------------ | ------:
01/01/2018 00:00:00 |    5000
02/01/2018 00:00:00 |    5000
03/01/2018 00:00:00 |    5000
04/01/2018 00:00:00 |    5000
05/01/2018 00:00:00 |    5000
06/01/2018 00:00:00 |    5000
07/01/2018 00:00:00 |    5000
08/01/2018 00:00:00 |    5000
09/01/2018 00:00:00 |    5000
10/01/2018 00:00:00 |   10000
11/01/2018 00:00:00 |   10000
12/01/2018 00:00:00 |   10000
13/01/2018 00:00:00 |   10000
14/01/2018 00:00:00 |   10000
15/01/2018 00:00:00 |   12000
16/01/2018 00:00:00 |   12000
17/01/2018 00:00:00 |   12000
18/01/2018 00:00:00 |   12000
19/01/2018 00:00:00 |   12000
20/01/2018 00:00:00 |   12000
21/01/2018 00:00:00 |   12000
22/01/2018 00:00:00 |   12000
23/01/2018 00:00:00 |   12000
24/01/2018 00:00:00 |   12000
25/01/2018 00:00:00 |   12000
26/01/2018 00:00:00 |   12000
27/01/2018 00:00:00 |   12000
28/01/2018 00:00:00 |   12000
29/01/2018 00:00:00 |   12000
30/01/2018 00:00:00 |   12000
31/01/2018 00:00:00 |   12000



dbfiddle here