Defferentiate "Inline table-valued functions" and "Views"

  • Hi,

    What is the difference between "Inline table-valued functions" and "Views". I mean can they be used as replacement of each other. Please explain performance wise and what can and cannot be done in both.

    Thankx in advance

  • The principal difference between the two is that the inline table valued function can be built with a parameter where a view cannot. Most of the time, but not all the time, the inline functions are resolved out to the component tables in the same way that views are. With the addition of a filter through the parameter, this can make them perform better than views in certain circumstances.

    However, test your code carefully. Functions, especially multi-statement table valued ones, can be serious performance pigs.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

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

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