• dwain.c (8/29/2012)


    RBarryYoung (8/29/2012)


    Unless the queries all strictly follow the same very simple format, this is going to fall somewhere between "Impossible" and "Incredibly Hard" to do in SQL.

    If the queries are all truly valid (i.e., actually compilable, with tables and columns that actually exist in the database), then there is a way to do it the is merely "Very Difficult, Slow and Kludgy".

    So Barry - what do you think of my suggestion?

    Poll (select all that apply):

    1. Impossible

    2. Incredibly hard

    3. Very Difficult

    4. Slow

    5. Kludgy

    6. Clever

    πŸ˜€

    4. Slow and 7. Tedious, going through all the queries adding "dbo." before each table name πŸ˜› πŸ˜€

    β€œWrite the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

    For fast, accurate and documented assistance in answering your questions, please read this article.
    Understanding and using APPLY, (I) and (II) Paul White
    Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden