Cycle through list run insert statement based on value from current row of list

I am trying to write  SQL Script that cycles through a column of values and performs an insert based on the value of the row. I have some written below.  I am struggling with how to cycle  through the list while running the insert statement for each siteid value.

create table #mytable
(isiteid int);

insert into #mytable values(20);
insert into #mytable values(291);
insert into #mytable values(347);
insert into #mytable values(469);
insert into #mytable values(473);
insert into #mytable values(635);
insert into #mytable values(722);
insert into #mytable values(729);
insert into #mytable values(754);
insert into #mytable values(760);
insert into #mytable values(967);
insert into #mytable values(1188);
insert into #mytable values(1390);
insert into #mytable values(1463);
insert into #mytable values(1489);

declare @isiteid int
declare @icnt int

select @icnt= count(*) from #mytable

--everything works fine until the line below
select @isiteid = top 1 isiteid from #mytable
 
while @icnt>0

insert into DMRepository
(iSiteId,vchDocName,iDocTypeId,vchSubject,vchMimeType,chUser,vchLogoPath,vchImgPath,
txtLitContent,iEmailType,iFaxType,iPrintType,tiRecordStatus,chUpdateBy,dtUpdateDate,iSurveyId,iAutoType,iTrackingEmail,DMRepositoryDocumentSourceId, OemLocked)
values
(@iSiteId,'Test',113128,’Test','text/html','fsjvera','','',
'Hello ',
1,1,0,1,'fsjvera',getdate(),0,1,1,2,0)

Delete top 1 from #mytable
Set @icnt= @icnt-1

end

Please let me know if any additional information is needed.
jverasqlAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jverasqlAuthor Commented:
I figured out how to do what I wanted.  How do I close the question?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Query Syntax

From novice to tech pro — start learning today.