Hello,
I'm trying to use SQL to remove contact point purposes from addresses that are marked inactive. I've come up with a query that pulls these addresses, but I am having trouble figure out the DELETE command. Any ideas?
Here's my code so far:SELECT * FROM [impresario].[dbo].[VS_ADDRESS] as aJOIN [impresario].[dbo].[TX_CONTACT_POINT_PURPOSE] as cON a.address_no = c.contact_point_idWHERE inactive = 'Y'
Thanks!Anne
First: Always do this in Test first! Then, something like this:
select * from TX_CONTACT_POINT_PURPOSE
begin transaction
delete cpp
from TX_CONTACT_POINT_PURPOSE as cpp
inner join T_ADDRESS as a on a.address_no = c.contact_point_id
and a.inactive = 'Y'
--commit transaction
rollback transaction
Thank you! I always work in Test first, especially in SQL! I will give this a shot.