SyntaxFix
Write A Post
Hire A Developer
Questions
I would prevent loops in general if i can, set approaches are much more efficient:
INSERT INTO tblFoo SELECT TOP (300) n = ROW_NUMBER()OVER (ORDER BY [object_id]) FROM sys.all_objects ORDER BY n;
Demo
Generate a set or sequence without loops