Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 delete from openxml

Author  Topic 

fmardani
Constraint Violating Yak Guru

433 Posts

Posted - 2007-02-26 : 12:09:30
Hi,
I know how to select using openxml.
Could you please let me have a sample code on how to delete records from a table based on what is inside an xml.
Thanks

Something like:
delete from table1
where
OPENXML (@idoc, '/marketData/forwardCurves/forwardCurve/maturities/maturity',2)
WITH (
contractMonth varchar(50),
[date] datetime,
mid varchar(50),
bizDays int
)

DustinMichaels
Constraint Violating Yak Guru

464 Posts

Posted - 2007-02-26 : 12:32:31
Your going to have to join the table you want to delete with the data from the OPENXML command.

DELETE a
FROM table1 a INNER JOIN OPENXML(...) b ON (a.ID = b.ID)
WHERE ...
Go to Top of Page
   

- Advertisement -