-
Hierarchical Query
Hi All,
We have CONNNECT BY PRIOR and STARTS WITH commands in ORACLE to query for a hierarchical data..
In MS SQL we don't have any such commands. So how can we achieve this in SQL? If it through stored procedures pls let me know how we can do this in Stored procedures...
Also pls let me know how to combine results sets of two diffrent select statements that returns same type and number of columns....
Any help is greatly appreciated.
TIA
Rgds
Manohar
-
Re: Hierarchical Query
Hi Manohar,
Microsoft give an example of expanding a hierarchy in their books on-line
included with SQL Server 8. If you have it installed, this link should find
the example:
mk:@MSITStore:C:\Program%20Files\Microsoft%20SQL%20Server\80\Tools\Books\acdata.chm::/ac_8_qd_14_5yk3.htm
To combine two similarly-shaped query results, use UNION or UNION ALL, e.g.
SELECT a, b FROM c
UNION
SELECT d, e FROM f
Hope this helps,
Simon Sellick.
Manohar <manu2679@yahoo.co.uk> wrote:
>Hi All,
>
>
> We have CONNNECT BY PRIOR and STARTS WITH commands in ORACLE to query
for a hierarchical
>data..
>
>In MS SQL we don't have any such commands. So how can we achieve this in
SQL? If it
>through stored procedures pls let me know how we can do this in Stored procedures...
>
>
>Also pls let me know how to combine results sets of two diffrent select
statements that
>returns same type and number of columns....
>
>Any help is greatly appreciated.
>
>TIA
>
>Rgds
>Manohar
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks