Cursor SQL 2012

We are currently load data to tables from a spread sheet.  The first table to load the "master"  is a one to many relationship.  To start we have a cursor that grabs the items to load.  IT then loads the master table inside of that cursor is another that pulls the many columns to populate using the ITEM from the outside cursor.  The inside cursor only runs one time and exits?  We pass it the item value from the outter cursor, the inside cursor pulls 8 values, for the ONE item value, but it will only load the first pass and exit.  

I am not real good with sql, so why doesn't it run the full eight times and then exit.  (Some will have as little as five runs)
BomInsert.sql
stevendeveloperAsked:
Who is Participating?
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.

HuaMin ChenProblem resolverCommented:
Check the data/record within the loop, to see what records are being scanned in that.
HuaMin ChenProblem resolverCommented:
Within the loop, you can also have temp table to hold the data returned, to know what is happening.
Arifhusen AnsariBusiness Intelligence Developer and AnalystCommented:
Hi ,

After

FETCH NEXT FROM rout  INTO  @job,@item_num, @OperationNum, @Work_Center,@CONTROLPOINT
WHILE @@FETCH_STATUS = 0

statement you have mentioned

two begin clause

I think you have 5 begin clause and only 4 end clause.

Please remove the duplicate begin. As per my idea wrong begin is placed after the statement i wrote above.

I have attached screen shot
Capture.PNG

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
stevendeveloperAuthor Commented:
I added a table to see what data was being captured and it ran as i expected it to the joins were the issues, on the update and inserts.  Thanks for all the advice i appreciate it.
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
Microsoft SQL Server 2008

From novice to tech pro — start learning today.