Спасибо всем, значит мне надо больше читать про индексы.
Теперь следующая задача.
Напишите запрос, показывающий все отличия таблицы @tt от таблицы @t
declare @t table(x int NOT NULL, y int)
declare @tt table(x int NOT NULL, y int)
insert into @t values(1, 3)
insert into @t values(2, 2)
insert into @t values(3, NULL)
insert into @t values(5, NULL)
insert into @tt values(1, 3)
insert into @tt values(3, NULL)
insert into @tt values(4, 3)
Мой ответ был
select * into #ttt from @t
union all
select * from @tt
select x,y
from #ttt
group by x,y
having count(*) = 1
Может есть более красивый способ?