If you read my last post, you’ll find this to the be exact opposite.  Instead of determining the best way to find rows that exist in one dataset but not another, we’ll be looking for rows that exist in 2 different datasets. The obvious answer is a join statement, but does that always perform the best?  Certainly, if you require other fields from the secondary table then a join will always be best.  For this test we are looking for rows that appear in a table called orderheader that are also in a temporary table called #ords.  The field that we are comparing is anRead More →

It is a pretty common need to find rows that exist in one dataset, but not in another.  The question I will look to answer today is, “which way is best?”.  For this test we are looking for rows that appear in a table called orderheader that aren’t also in a temporary table called #ords.  The field that we are comparing is an INT called ord_hdrnumber and it is the Clustered Primary Key of each table. We’ll compare the pros, cons, and performance of 4 popular methods to complete the task.   –NOT IN SELECT a.ord_hdrnumber FROM orderheader a WHERE a.ord_hdrnumber NOT IN (SELECT b.ord_hdrnumberRead More →

After a recent presentation where I left a few of my audience members unable to see some demos I felt like I needed to make sure I was more prepared for future presentations.  My slide deck was quite visible and I was able to quickly zoom in  on the SQL text in the query editor window, but the results pane was an issue. I see 2 solutions to the issue.  The first is to simply use ZoomIt, a popular tool that every presenter (except me apparently) already has installed.  ZoomIt is a free download from Microsoft and allows you to quickly zoom in on the screen andRead More →

I’m about a day late to post this, but I hope a few of you saw me at the Ohio North SQL Server User Group last night.  I had a great time presenting on Window functions.  I hope to present again soon.   http://ohionorth.sqlpass.org/PastMeetings.aspx?EventID=5961  Read More →