0

I have a table A and a user defined table type on which a table value parameter (tvp) tvpA is based. Both have the same column structure except that tvpA is not defined with any constraint.

What I'd like to do is to delete rows in A that are not in tvpA based on one of their field called ID.

How can I do that ?

Paul White
95.4k30 gold badges440 silver badges689 bronze badges
asked Mar 3, 2017 at 10:02

1 Answer 1

3

Is there a reason this simple correlated delete statement won't do the trick?

DELETE A
FROM TABLE_A A
WHERE NOT EXISTS (
 SELECT *
 FROM TVP_A
 WHERE ID = A.ID
 )
answered Mar 3, 2017 at 10:37

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.