This just looks so odd to me:
delete from GearsDev.dbo.Products
from GearsDev.dbo.Products as C
inner join #Common as M
on M.item = C.ItemNumber
You can constrain the set of records you want to delete by more than one table. The second from just generates the alias C for the table you delete from, joins it with the table #common and deletes only records which have a record in talbe #common.
As can be seen from the documentation of DELETE, it can take two FROM clauses.
The first FROM:
FROM: Is an optional keyword that can be used between the DELETE keyword and the target table_or_view_name, or rowset_function_limited.
The second FROM:
FROM <table_source>: Specifies an additional FROM clause. This Transact-SQL extension to DELETE allows specifying data from and deleting the corresponding rows from the table in the first FROM clause.This extension, specifying a join, can be used instead of a subquery in the WHERE clause to identify rows to be removed.
So, the SQL will delete records from the Products table that have a matching item when it is joined with #common.
This is equivalent (in meaning) to the following query:
delete from [GearsDev].[dbo].[Products]
where ItemNumber in
(
select item from #common
)
From MSDN The second from allows you create a filter that corresponding rows in the first from are deleted where they match.
In this case Delete all [GearsDev].[dbo].[Products] where ItemNumber has a corresponding row in #Common with the item of the same value