• charu.verma (12/11/2009)


    Thanks-but this will not work

    The cloumns in Tbl3 have to be deleted tnum of tbl2,formatted tnum returned from fucntion & sid of tbl1 & not oid of tbl2

    The code I provided does exactly what you wanted, according to the instructions Step1, Step2 and Step3 in your first post. If you know for certain what you want to do, then please say so in a clear and unequivocal manner.

    Given the data sets which I provided for you, what should your output be?

    If the data I provided for you is insufficient, please augment it until it is suitable for testing, using the same code - INSERT INTO .... SELECT.

    “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