3 ms·
Recursion in SQL is one of the questions I always ask Data Engineers during interviews. The answer in MS T-SQL is to use a recursive CTE. It is not a common p
by TedDallas 6y ago
Recursion in SQL is one of the questions I always ask Data Engineers during interviews. The answer in MS T-SQL is to use a recursive CTE. It is not a common problem, but it comes up once in a while. Using a CTE is a better solution than calling an SP recursively because you can only nest 32 calls deep. In the MS Azure SQL Data Warehouse product you are simply fucked if you need to do recursion.
- mycall 6y ago> SP recursively because you can only nest 32 calls deep T-SQL only gives you 100 calls deep. Also, having CTEs calling other CTEs can create a very slow query plan, which takes unrolling each CTE into either a table variable or temp table to resolve.
- deleted 6y ago[deleted]
- thinkloop 6y ago> Recursion in SQL is one of the questions I always ask Data Engineers during interviews Everyone always asks that in every language at every interview and it is rarely used in practice - ahhh interviews.
- kls 6y agoI think it depends on the developers style of how they reason. I use recursion a lot when dealing with loose data, to clean it up. Recursion is one of my go to's for deduplicating list.