Need help

  • How long does this take to run:

    SELECT [item] FROM dbo.fn_Split('33',',')

    Can you post the CREATE statement for this function?


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • Sorry, I forgot to mention about it it takes no time to return results.

  • Can you post the actual plan for both queries - and the code for the function? Looks like the function is being executed once per row and it only needs to be run once per query.

    Two possible quick fixes:

    Run the subquery separately, output the results to a #temp table then use EXISTS in your main query. Since you're using TOP, you could simply join it, but the intermediate working set would be larger.

    Introduce the function using CROSS APPLY.


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

Viewing 3 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply