October 27, 2009 at 10:17 am
Hello,
I am in the process of creating a recursive query, but have no idea on the basics i.e. recursion,looping through sql statements etc.
Could some give me a drill down ?
October 27, 2009 at 10:45 am
Hi,
Can you give a llittle more info on exactly what it is you need a loop for?
For the time being have a look at the following article (SQL Server 2005, wont work on 2000)
October 27, 2009 at 11:14 am
Your question is pretty open-ended. It would help us in helping you if you could provide more specifics regarding your problem. Please take the time to also read the first article I reference below in my signature block regarding asking for assistance. if you follow the instructions in that article you we get much better answers to your questions.
October 28, 2009 at 3:28 am
If you're interested in how the recursive queries work, see
http://sqlblog.com/blogs/linchi_shea/archive/2009/04/16/recursive-sql-queries-how-do-they-work.aspx
October 28, 2009 at 9:00 pm
martin.edward (10/27/2009)
Hello,I am in the process of creating a recursive query, but have no idea on the basics i.e. recursion,looping through sql statements etc.
Could some give me a drill down ?
The only time you should use recursion is for hierarchies. The only time you should use a loop is for flow control across tables or databases... that leaves out 99.9% of all queries.
Rather than learn the wrong way to do things by learning recursion and loops first, take a look at the following article for an alternative to needing most loops...
http://www.sqlservercentral.com/articles/T-SQL/62867/
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply