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 2005 Forums
 Transact-SQL (2005)
 Update Statement - urgent

Author  Topic 

vmurali
Yak Posting Veteran

88 Posts

Posted - 2007-01-19 : 01:23:24
How do we write the update statement when input is as xml.
Suppose my xml is as
<table tablename="Leave_info">
<col colname="Emp_Code" colvalue="906342" />
<col colname="Approve_Reject" colvalue="Reject" />
<col colname="Approve_date" colvalue="1/2/2007" />
</table>



snSQL
Master Smack Fu Yak Hacker

1837 Posts

Posted - 2007-01-19 : 14:02:57
Use sp_xml_preparedocument to load the XML, then OPENXML to get the data from the XML as a rowset and then just write a regular UPDATE statement to update the table from the rowset you get from OPENXML.
Go to Top of Page
   

- Advertisement -