sql query help

how can i use this oracle query in sql i mean the same query structure in mssql
i want to write the same query in mssql
SQL> select name, taskid,parentid,levelnumber,creator,userparameter2,usercomment
 from task
  2  connect by parentid = prior taskid
  3  start with taskid =
  4  (select taskid from task);
(select taskid from task)
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Walter RitzelSenior Software EngineerCommented:
I believe this 2 links should help you:

Example code:
WITH TaskHierarchy (name, taskid,parentid,levelnumber,creator,userparameter2,usercomment) AS
   -- Base case
      name, taskid,parentid, 1 as levelnumber, creator,userparameter2,usercomment
   FROM task
   WHERE parentid IS NULL


   -- Recursive step
     e.name, e.taskid,e.parentid
      eh.levelnumber + 1 AS levelnumber
, e.creator,e.userparameter2,e.usercomment
   FROM task e
      INNER JOIN TaskHierarchy eh ON
         e.parentid = eh.taskID

FROM TaskHierarchy
ORDER BY levelnumber

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
romeiovasuAuthor Commented:
This one actually i have to create on a crystal report.  I am getting an error as an unresponsive alias.
Walter RitzelSenior Software EngineerCommented:
Humm, just figuring if queries on Crystal Reports have some kind of limitation... In this case, I suggest that you open a different question.  Have you tested the query direct on SQL Server Management Studio?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.