How to view Execution plan for a function

  • Hi

    I have a function call within an SP which is taking up 85% of the entire query.

    I tried a Select * from Function_Name(parameter1, parameter2...)

    and it would not give me a break up of the function in the execution plan.

    There are only Table variables within which hold the select statement results in the function.

    EG:

    Create function Function_Name(par1, par2) RETURNS @table1 TABLE

    as

    Begin

    Declare @table1 Table (Id int, name varchar(20))

    Insert into @table1

    Select id, name

    from Names

    end

    Is it because tof the use of Table variables, that the select statements are not visible in the execution plan.

    Is there any way I can view it?

  • Profiler. Use the showplan_xml event

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Make it a view.

    It will simplify everything.

    _____________
    Code for TallyGenerator

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

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