• Hugo Kornelis (1/31/2012)


    Meh, I don't like questions where people who really understand the subject have a 50/50 chance of getting it right because they have to second-guess the author's intention.

    "Is this a question about the official rules and limitations, or about workarounds?" -- I guessed wrong. :crying:

    I was aware of the ability to do it indirectly so I answered that it was possible and guessed correctly. If I got it wrong, I was prepared to give examples of how it could be done.

    Some of these QOTD's are tough because you don't know if the author is using BOL or their own experience to generate the question. Just because it's in BOL doesn't mean there isn't a workaround such as using a UDF to access another table's column.

    For the person referencing msdn's page http://msdn.microsoft.com/en-us/library/ms191250.aspx :

    It does not state you cannot access columns from another table, it says:

    A computed column is computed from an expression that can use other columns in the same table.

    Notice it says "can use" instead of "must use"

    It also goes on to say:

    The expression can be a noncomputed column name, constant, function, and any combination of these connected by one or more operators.

    Notice that it specifically states you can use a function. As we all know, the function can derive information from any of your tables.