SQL Server Nation
For all of your SQL Server needs.

Browse by Tags

  • Using APPLY to match a table valued function to a table

    In this article, I will explain how to use the APPLY operator to join the results of a table valued function to a table. The APPLY operator allows a table column to be supplied as an input parameter to a table valued function. Microsoft describes the APPLY operator as "The new APPLY relational operator allows you to invoke a specified table-valued function once per each row of an outer table expression" ( source ). Basically what that means is that you can join a table valued function to...
  • The Numbers Table (Round 2)

    Originally I wrote about The Numbers Table over at SQL Server Central . Over there I presented the structure and a couple options on how to populate it. I won't dwell on all of that again. I'm just going to keep it simple. What is a numbers table? A numbers table is a table containing sequential integer values. The size of your table will vary depending upon how you may choose to use it. Most practical applications that I have encountered have never called for more than 100,000 records but...
  • Comparing a Sub-Query and a UDF

    There has always been a lot of confusion in terms of performance between correlated sub-queries vs user-defined functions. So, I've taken it upon myself to try to figure out which one is more effecient. The results I have found are by no means conclusive, but will hopefully give you an idea as to when to use which approach as well as a general methodology for how to compare queries for effeciency purposes. First, I'll start by creating a scalar user defined function that accepts the EmployeeID...
Copyright SQL Server Nation 2010
Powered by Community Server (Non-Commercial Edition), by Telligent Systems