• bitbucket-25253 (1/12/2013)


    L' Eomot Inversé (1/12/2013)


    Nice clear straightforward question.

    Good to see a question on this new feature.

    Interestingly, there's an error on the BoL page: it says the CHOOSE function

    BoL


    Returns the data type with the highest precedence from the set of types passed to the function

    The first argument is an integer, which has a higher type precedence than any character type, but if it really was going to return an int we would have string to int conversion errors here. BoL should instead say that the return type is highest precedence type of the arguments other than the first.

    From the supporting link in the question

    CHOOSE acts like an index into an array, where the array is composed of the arguments that follow the index argument. The index argument determines which of the following values will be returned.

    Yes, it says that. But that says nothing about the type returned, it's about which value is selected before any necessary type conversion is done. The same page contains the incorrect statement that I quoted, which says nothing about which value is selected, only about which type it is to be converted to (which it gets wrong).

    Tom