Why is this sql line not working
database, sql, t-sql
Solution
It doesn't insert anything because your `WHILE` condition is:
WHILE @counter < @numtoinsert
And 101 > 100, so it never enters the loop.
Problem
It says that the command executed successfully but there are no values inserted into the organization table. ``` DECLARE @now DATETIME SET @now = GETDATE() DECLARE @numtoinsert INT SET @numtoinsert = 100 DECLARE @counter INT SET @counter = 101 WHILE @counter < @numtoinsert BEGIN SET @counter = @counter + 1 INSERT INTO [MVServices].[dbo].[Organization] ([Organization_Id] ,[Business_Number] ,[Legal_Name] ,[Common_Name] ,[Operating_As] ,[Sort_Name] ,[Effective_Date] ,[Expiry_Date] ,[Created_By] ,[Created_Date] ,[Last_Changed_By] ,[Update_Date]) VALUES (@counter ,1234 ,'ABC Construction' ,'ABC' ,'ABC Construction' ,'ABC Construction' ,@now ,null ,'seed' ,@now ,null ,null) END ```