Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2001-09-18 : 22:07:09
|
Austin writes "Ya'll,I have scoured the eacth for the answer and cannot find it yet.I have a table with the fields: Part_ID, ParentPart_ID, Part#.The first field is an identity field with a seed of 1 and increment by 1. The second field, ParentPart_ID, is used for the hierarchical relationship. When Part_ID = ParentPart_ID (Maybe NULL?) the highest node is defined. Ex.:Part_ID ParentPart_ID Part#1 1 123452 1 111113 2 222224 4 333335 4 11111 Notice some part#s are reused, but they belong to another hierarcical relationship of parts. The depth of the hierarchy is not fixed and can vary from day to day.I am looking at only having one interaction with the server to insert all of the Part#s. After I have sent the parts to the server I need the Part_IDs for the highest nodes returned from the stored procedure.I have seen a UDF in SQL Server Magazine(July p57) or message thread called fn_Split to accept a Text string and split the text into a table resembeling an array. I have contemplated using this function and decided a text string something like:/1\/2\12345/2\/3\11111/3\22222/1\/2\33333/2\11111would work, but I do not know how to loop the UDF and insert these values one at a time and compile a list of only the highes nodes to return.Thanks,Austin" |
|
|
|
|
|