Unix Technical Forum

SQL Challenge Urgent, Please help

This is a discussion on SQL Challenge Urgent, Please help within the SQL Server forums, part of the Microsoft SQL Server category; --> Hello Expert, Here I am asking your help. I have a table with following data: TaskID ParentTaskID TaskName ProjectName ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-29-2008, 08:06 PM
Dip
 
Posts: n/a
Default SQL Challenge Urgent, Please help

Hello Expert,
Here I am asking your help.
I have a table with following data:
TaskID ParentTaskID TaskName ProjectName
1 1 BA Rail
2 22 FA Financial
3 1 BA.1 Rail
4 1 BA.2 Rail
5 22 FA.1 Financial
6 22 FA.2 Financial

Now I want the following format:

ID ParentID Name
1 1 Rail
2 1 BA
3 2 BA.1
4 2 BA.2
5 22 Financial
6 5 FA.1
7 5 FA.2

I need to create following hierarchy if I could tranform the data the
above way in the Project Dimension:
Rail
--BA
----BA.1
----BA.2
Financial
--FA
----FA.1
----FA.2
Please help and thanks in advance,
Soumya

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-29-2008, 08:07 PM
Kart
 
Posts: n/a
Default Re: SQL Challenge Urgent, Please help

Look at "Expanding Hierarchies" in SQL Server 2000 BOL. I think that
should help

Dip wrote:
> Hello Expert,
> Here I am asking your help.
> I have a table with following data:
> TaskID ParentTaskID TaskName ProjectName
> 1 1 BA Rail
> 2 22 FA Financial
> 3 1 BA.1 Rail
> 4 1 BA.2 Rail
> 5 22 FA.1 Financial
> 6 22 FA.2 Financial
>
> Now I want the following format:
>
> ID ParentID Name
> 1 1 Rail
> 2 1 BA
> 3 2 BA.1
> 4 2 BA.2
> 5 22 Financial
> 6 5 FA.1
> 7 5 FA.2
>
> I need to create following hierarchy if I could tranform the data the
> above way in the Project Dimension:
> Rail
> --BA
> ----BA.1
> ----BA.2
> Financial
> --FA
> ----FA.1
> ----FA.2
> Please help and thanks in advance,
> Soumya


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-29-2008, 08:09 PM
--CELKO--
 
Posts: n/a
Default Re: SQL Challenge Urgent, Please help

Get a copy of TREES & HIERARCHIES IN SQL for several diffrent ways to
model this kind of problem.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 01:33 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com