I want to insert couple of hundred rows into a table that points to pk in other table. I have been trying to use while loops for inserting multiple records in the table. I am actually setting up my test data.
This is what I am doing :
declare @count int;
set @count = 4018;
while @count <= 5040
begin
INSERT INTO [MY_TABLE]
([pk_from_other_table]
,[..]
,[...]
,[..]
,[..]
,[...]
,[...]
,[..])
select
(pk_from_other_table,
,[..]
,[...]
,[..]
,[..]
,[...]
,[...]
,[..])
@count = @count + 1;
end
but this does not seems to work ! can anyone help please... all I want to do is insert number of records = number of records that exist in primary table.
? any idea on how can I achieve this ?
I either get incorrect sytax near count
or
Msg 102, Level 15, State 1, Line 17 Incorrect syntax near ','.