It's done with the use of ID but I want without using ID
SELECT
ID
,COALESCE(p.number,
(SELECT TOP (1) number
FROM tablea AS p2
WHERE
p2.number IS NOT NULL
AND p2.ID <= p.ID ORDER BY p2.ID DESC))as Number--,Result = p.number
FROM TableA AS p;
ID number
1 100
2 150
3 NULL
4 300
5 NULL
6 NULL
7 450
8 NULL
9 NULL
10 560
11 NULL
12 880
13 NULL
14 579
15 987
16 NULL
17 NULL
18 NULL
IDis used to define the order of rows. If you have other columns that define the order, use them. If you don't have such a column - add it. Somehow you need to tell the server what does "previous" row mean.