C2 said that the Indigo stuff was interesting, but requested that I stop talking about stuff that won't be here for another 18 months. Therefore, I am going back to some SQL Server 2005 stuff. I will continue to talk more and more about SQL Server 2005 just because there are so many new features and there are not a lot of articles out there on it.
Today's topic is the INTERSECT operator. This is a new operator that allows you to join two sets of data on all columns in the select clause. For example, if you had two tables with similar schemas and Both Table1 and Table2 have columns named Column1, Column2, and Column3, the INTERSECT operator can be used.
If you wanted to find out which items in Table2 have exact duplicates in Table1, you would have to write something like this today:
SELECT Table1.Column1, Table1.Column2, Table3.Column3 FROM Table1 INNER JOIN
ON Table1.Column1 = Table2.Column1
AND Table1.Column2 = Table2.Column2
AND Table1.Column3 = Table2.Column3
Clearly, that's a bad time if you had a table with a lot of columns. Now all you have to do is:
SELECT Column1, Column2, Column3 FROM Table1
SELECT Column1, Column2, Column3 FROM Table2
I believe this statement will be extermely useful when needing to compare the data in two tables.
Read the complete post at http://www.dotnettipoftheday.com/blog.aspx?id=170