'How will while loop work in sql server user defined function [duplicate]
If I use a while loop inside my user defined function and the function returns a variable at last.. will the function return value for each iteration or will it return for only one iteration and end
If I consider a scenario as below
create or replace myFunction(
-- I declare some variables (input and locals)
@variable1 varchar(4000)
)
as
returns varchar(4000);
while loop begins
do some calculations on variable1(for eg)
increment counter for while
end while loop
return @variable1;
end
In this case will return work for every while condition or only once.. What can be done to return for every while true condition
Thanks for the help!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
