Declare BigTable table (KeyColumn1 int, KeyColumn2 int,
KeyColumn3 int, KeyColumn4 money, column5 nvarchar (25))
Declare @Temptable table (KeyColumn1 int, KeyColumn2 int,
KeyColumn3 int, KeyColumn4 money, column5 nvarchar (25))
@Temptable has several thousand rows
Bigtable has million rows
Do the following two queries have any differnet?
Delete dbo.BigTable with (Rowlock) From dbo.BigTable i Left Outer Join @Temptable ii on i.KeyColumn1= ii.KeyColumn1and i.KeyColumn2= ii.KeyColumn2
and i.KeyColumn3= ii.KeyColumn3 and i.KeyColumn4 = ii.KeyColumn4 Where i.KeyColumn1= @IntNumber and i.KeyColumn3= @IntPeriod
and ii.KeyColumn1is Null and ii.KeyColumn2 is Null and ii.SubPeriod is Null and ii.PriceSoldAt is Null vs. Delete dbo.BigTable with (Rowlock) From dbo.BigTable i Left Outer Join @Temptable ii on i.KeyColumn1= @IntNumber and i.KeyColumn4 = @IntPeriod and i.KeyColumn1 = ii.KeyColumn1 and i.KeyColumn2 = ii.KeyColumn2 and i.KeyColumn3 = ii.KeyColumn3 and i.KeyColumn4 = ii.KeyColumn4 Where ii.KeyColumn1is Null and ii.KeyColumn2 is Null and ii.KeyColumn3 is Null and ii.KeyColumn4 is Null
JaneC