I'm using SQL Server 2014. I have a table function which takes 2 parameters and returns 2 columns. For the sake of simplicity, let's call the function Get_GroupNumber.
Get_GroupNumber('Smith', '123-456-789')
This will return 2 columns. Again keeping it simple let's say it is Reason1 and Reason2.
Reason1 = '111-222-333'
Reason2 = '555'666'777'
I need to pass Reason1 which is returned back into Get_GroupNumber, and keep doing so until it returns a NULL in Reason1 and also NULL in Reason2.
So, the second call would look like this:
Get_GroupNumber('Smith','111-222-333')