1

I have created a parameterized U-SQL procedure and I want to call it recursively by employee id. Is there a way we can implement recursion in U-SQL? Thanks!

2 Answers 2

2

U-SQL does indeed support recursion and you can view the Recursive TVF example here. However, recursive approaches aren't something that generally scale very well, so you may need to consider a different approach.

Paul Andrew describes another approach to recursion using Powershell here.

If you could provide some sample data and expected results, I'm sure someone will be able to help you. I would guess you don't need a recursive approach, you simply need a set-based one.

Sign up to request clarification or add additional context in comments.

Comments

0

To add to Bob's answer (not sure if I should edit his answer or provide my own, so here I go):

  1. Recursive TVFs have a nesting level limit of 50.
  2. You cannot/should not call Procedures recursively, since they produce side-effects (like writing into tables or files). Instead, write a recursive TVF that produces the rowset that you then want to write in a procedure.

But as Bob mentions, please see if you can find a set-based solution or using an existing feature that does not involve recursion.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.