February 13, 2011 at 5:22 am
I AM TRYING TO DELETE CONTACT ID FROM CONTACT AND SALESHEADER TABLES USING OUTPUT.DELETED OPTION( CONTACTID IN SALESHEADER REFERS TO CONTACT TABLE). I AM NEWBIE TO SQL PLEASE HELP ME SOLVE
CAN ANYBODY HELP ME SOLVE
Contact table contains following columns
- contactid,
- firstname
salesheader table contains following columns
- SALESORDERID
- CONTACTID
- TOTALDUE
DECLARE @DeleteOutput3 TABLE (CONID INT PRIMARY KEY CLUSTERED)
DELETE Contact
OUTPUT
deleted.CONTACTID
INTO @DeleteOutput3
WHERE CONTACTID = 10;
DELETE SALESHEADER FROM SalesHeader INNER JOIN
@DeleteOutput3 d ON SalesHeader.CONTACTID=d.CONID
February 13, 2011 at 5:55 am
sure going forward will make sure that
thanks
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply