Hi,
How can Insert the same record until I find the next value in SQL? Here is my sample code/data.
Blockquote
DECLARE @test as table
(
id int IDENTITY(1,1),
code varchar(20),
result varchar(20)
);
INSERT INTO @test (code,result)
VALUES
('R235','Good'),
('R236',''),
('R236',''),
('R235','Failed'),
('R238',''),
('R239','Verified'),
('R239',''),
('R235','')
SELECT * FROM @test t
Here what I want.
Final output
id,code,result
1,R235,Good
2,R236,Good
3,R236,Good
4,R235,Failed
5,R238,Failed
6,R239,Verified
7,R239,Verified
8,R235,Verified
Thanks for help!