Have you tried asort() on each of the ordering columns from least significant to most significant?
If this works, benchmark against a cursor.
>Ok Folks...
>
>I need a UDF that will sort and array using multiple columns... simmilar to an ORDER of a select.
>
>My particular array has 3 columns, but, to make it generic, and more challenging, lets allow the ordering to work on an unknown number of rows, and not limit the ordering to a certain number or rows.
>
>For example... if I have an array such as....
>
>
>
>Row Col1 Col2 Col3
>1 C 900 10
>2 A 901 11
>3 A 902 12
>4 B 903 13
>5 A 904 14
>6 B 905 15
>
>
>
>I want to be able to call my UDF like...
>
>Prototype
>
>AORDER( ARRAY by Reference, ORDER String )
>
>AORDER( @MyArray, '1,2')
>
>And get the following result:
>
>
>Row Col1 Col2 Col3
>1 A 901 10
>2 A 902 12
>3 A 904 14
>4 B 903 13
>5 B 905 15
>6 C 900 10
>
>
>BOb