Is it possible to do something along those lines:
DELETE TOP开发者_开发知识库(1) m
FROM MyTable m
OUTPUT deleted.*
LEFT JOIN MyOtherTable ON MyOtherTable.SomeColumn=s.SomeColumn
I know this works:
DELETE TOP(1)
FROM MyTable
OUTPUT deleted.*
And this also works (although pointless):
DELETE TOP(1) m
FROM MyTable m
LEFT JOIN MyOtherTable ON m.SomeColumn=MyOtherTable.SomeColumn
Move the OUTPUT
clause to before the JOIN
DELETE TOP(1) m
OUTPUT deleted.*
FROM MyTable m
LEFT JOIN MyOtherTable ON MyOtherTable.SomeColumn=s.SomeColumn
精彩评论