Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is this Possible ?

Status
Not open for further replies.

mukund

Programmer
Mar 6, 2001
64
GB
Hi,
I have a set of records in one table
for e.g.

Singapore
Singapore\Admin
Singapore\Admin\Bank
Singapore\Admin\Contacts
Singapore\Admin\Finance
Singapore\Admin\Finance\Payroll
Singapore\Admin\HR
Singapore\Admin\HR\TimeSheets
Singapore\Admin\Insurance
Singapore\Admin\IT
Singapore\Admin\Legal
Singapore\Admin\Managenmant Report
Singapore\Admin\Memberships
Singapore\Admin\Travel
Singapore\BizDev

I want to generate a code for these type of records in the following manner.

Can this be done using a SP. Using string manipulation functions ?

Path Code
Singapore 1
Singapore\Admin 1.1
Singapore\Admin\Bank 1.1.1
Singapore\Admin\Contacts 1.1.2
Singapore\Admin\Finance 1.1.3
Singapore\Admin\Finance\Payroll 1.1.3.1
Singapore\Admin\HR 1.1.4
Singapore\Admin\HR\TimeSheets 1.1.4.1
Singapore\Admin\Insurance 1.1.5
Singapore\Admin\IT 1.1.6
Singapore\Admin\Legal 1.1.7
Singapore\Admin\Managenmant Report 1.1.8
Singapore\Admin\Memberships 1.1.9
Singapore\Admin\Travel 1.1.10
Singapore\BizDev 1.2

and so on.

These codes can be used to build a heirarchy tree using Jav Script.

Any suggestions/solutions are welcome.

Mukund.
 
Try reading the BOL article called "Expanding Hierarchies" it will give you a good idea on hot to handle this kind of data. If you still have questions let me know. AL Almeida
NT/DB Admin
"May all those that come behind us, find us faithfull"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top