Looping Challege

  • Hi,
    I have an interesting project.  I need to show materials that make up parts then find materials that make up those materials that they are composed of if any.  Not sure of what technique to get started with.  Any ideas?  Recursive?  Some kind of looping?  See the attachment of the result set I am looking for.

    Thanks,
    Calvin

  • calvin.clay - Friday, August 25, 2017 9:27 AM

    Hi,
    I have an interesting project.  I need to show materials that make up parts then find materials that make up those materials that they are composed of if any.  Not sure of what technique to get started with.  Any ideas?  Recursive?  Some kind of looping?  See the attachment of the result set I am looking for.

    Thanks,
    Calvin

    It depends on the data structure that you have. If you still don't have the structure, I suggest that you read the following articles:
     http://www.sqlservercentral.com/articles/Hierarchy/94040/
     http://www.sqlservercentral.com/articles/T-SQL/94570/
    If you have a structure, just share it with us to give you any pointers.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • This is known in the business world as BOM, or Bill Of Materials.   That's another avenue you can investigate online, in addition to the excellent suggestions Luis has made.

  • Thanks Luis and Steve!  Luis, I got to try those links and Steve, I'll do a search on sql and BOM to see what's out there.

    Calvin

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply