• First off...yes this is the WRONG way to do things.

    You won't be able to do it in a single field, but you can do it with multiple fields (i think):

    Using your code sample, try the following for each type of field you want:

    SELECT

    DataType,

    MAX(

    CASE WHEN DataType in ('CURRENCY','NUMBER') THEN CAST(Value AS DECIMAL(18,2))

    ELSE NULL END) AS MaxNumber,

    MAX(

    CASE WHEN DataType in ('Date') THEN CAST(Value AS Datetime)

    ELSE NULL END) AS MaxDate,

    FROM GetMaxValues

    GROUP BY DataType

    Hope this works!

    --------------------------------------------------------------------------
    When you realize you've dug yourself into a hole....Step 1...stop digging.