I am running a while loop in my sql query
and creating a sql string, which I am executing at the end.
I am adding Union All in the sql server inside the while loop.
now I want to remove the last Union all from the sql string before running it otherwise I am getting an error becasue after last Union all there is no sql statements because the while loop ends.
Can any one help me out here, how can I replace the last union all from my sql string.