I want to fill a Table quick. I have tried something but its not working. Here is my MSSQL-Script:
CREATE FUNCTION [dbo].[fillTable] ( @Amount INT )
RETURNS @Integers TABLE ( [IntValue] INT )
AS
BEGIN
DECLARE @Counter INT
SET @Counter = 0
WHILE @Counter < @Amount
BEGIN
INSERT INTO [Table] (Col1, Col2, Col3, Col4) SELECT '1', '2', '3', '4' ;
SET @Counter = @Counter + 1
END
RETURN
END
GO
And i want to call the function with
SELECT [fillTable] (100000);
to execute
INSERT INTO [Table] (Col1, Col2, Col3, Col4) SELECT '1', '2', '3', '4' ;
100000 times.
I need some help...