While Loop in SQL

SQL server

Using loops we can populate table with dummy values


DECLARE @i INTEGER;
SET @i = 1;
 
WHILE @i <= 100
BEGIN
	INSERT INTO Table1(UserName,Address) VALUES(
    	CONCAT('User', @i),
        CONCAT('Jeremy #', @i))
   SET @i = @i + 1;
END;

Post a Comment

Previous Post Next Post