In my simple test case my database is so small: 1 table with 3 columns and 1 record !! no index !
I think there really is a probleme with GetBoundingBox !! The same app was working great before and now with only changing the MapSuite version the GetBoundingBox fails, I think you really should take a look at it !
I managed to get the request that fails and I'm putting it below.
I'm also providing here some screenshot if it can help you or if you can see I'm making something wrong:
My database:
The request that will never end (even after 16 minutes !):
DECLARE @polygon01 geometry;
DECLARE @polygon02 geometry;
DECLARE mycursor cursor for select featureShape from features;
open mycursor;
while(@polygon01 is null)fetch mycursor into @polygon01;
while(@polygon02 is null)fetch mycursor into @polygon02;
if (@polygon02 Is not NULL) begin set @polygon01 = @polygon01.STUnion(@polygon02.STEnvelope()).STEnvelope();
fetch mycursor into @polygon02;
while @@FETCH_STATUS = 0 begin if(@polygon02 is not null)set @polygon01 = @polygon01.STUnion(@polygon02.STEnvelope()).STEnvelope();
fetch mycursor into @polygon02;
end;
end;
SELECT @polygon01.STAsBinary();
CLOSE myCursor;
DEALLOCATE myCursor;
Thank you.