Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Function Recursive Expand / Collapse
Author
Message
Posted Tuesday, April 15, 2008 11:35 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Wednesday, November 6, 2013 3:41 AM
Points: 22, Visits: 17

Hello,

Well i have never check that either recursive function is possible in sql server (any version) is possible or not. Is any person having experience about that???????????

thanks

Post #485210
Posted Tuesday, April 15, 2008 12:18 PM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 8:20 AM
Points: 10,206, Visits: 13,151
Can you explain what you need to do? Sql Server works best with sets and recursion is typically a row by row operation. My guess is that there is a set-based solution to your problem.



Jack Corbett

Applications Developer

Don't let the good be the enemy of the best. -- Paul Fleming

Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
How to Post Performance Problems
Crosstabs and Pivots or How to turn rows into columns Part 1
Crosstabs and Pivots or How to turn rows into columns Part 2
Post #485228
Posted Tuesday, April 15, 2008 12:29 PM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Friday, June 27, 2014 12:43 PM
Points: 13,872, Visits: 9,596
You can have recursive triggers (which are usually a problem, but can be done if needed) in SQL Server.

You can have recursive procs in both 2000 and 2005 (might be able to earlier, I don't know since I haven't used those).

In 2005, there are recursive CTEs, which are CTEs (Common Table Expressions) that reference themselves in a Union All statement.

However, a view can't reference itself recursively in any version (nor should it). (Note: You can create a view that references itself, but when you try to select from it, you'll get an error.)

User Defined Functions can reference themselves recursively.

In all cases, you can run into the max recursion limit.


- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread

"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
Post #485236
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse