while loop is used for to iterate loop one by one /
iterate row one by one.
it's an alternative to Cursor.
example,
create Table Test
(
Id int identity(1,1),
Testid uniqueidentifier
)
(
Id int identity(1,1),
Testid uniqueidentifier
)
GO
Declare @i INT=1
While (@i<1000)
BEGIN
Insert into Test(Testid) values (newid())
Set @i=@i+1
END
GO
select * from Test
Simple While loop
Comments
Post a Comment
If you have any doubt then please let me know in comment section.