For loop in sql serever
Hi Friend
pelase check the how to loop the and insert data into db using the for loop in sql server (For multiple values )
DECLARE @CNT INT
DECLARE @Q NVARCHAR(1000)
SET @CNT = 110001
WHILE(@CNT <= 113500)
BEGIN
SET @Q = 'insert into plate_numbers values('+ CAST (@CNT AS NVARCHAR) + ')'
-- PRINT @Q
EXEC sp_executesql @Q
SET @CNT = @CNT + 1
END
Regards,
Bhaskar
pelase check the how to loop the and insert data into db using the for loop in sql server (For multiple values )
DECLARE @CNT INT
DECLARE @Q NVARCHAR(1000)
SET @CNT = 110001
WHILE(@CNT <= 113500)
BEGIN
SET @Q = 'insert into plate_numbers values('+ CAST (@CNT AS NVARCHAR) + ')'
-- PRINT @Q
EXEC sp_executesql @Q
SET @CNT = @CNT + 1
END
Regards,
Bhaskar
Labels: for loop, while loop in sql server