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
 General SQL Server Forums
 New to SQL Server Programming
 how to update XML data in 2 table s

Author  Topic 

mohan123
Constraint Violating Yak Guru

252 Posts

Posted - 2013-02-04 : 00:44:20
i had two tables in which XML data is there 1 is a history table and another normal table. So xml data of Table named users need to be updated in users history tables simultaneously when and need to update in XML data.

<?xml version="1.0" encoding="utf-16"?> <DataTable> <xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:MainDataTable="PostedBy" <isReviewedPostedBy>0</isReviewedPostedBy> <isReviewedPostedByFirstName>0</isReviewedPostedByFirstName> <isReviewedPostedByLastName>0</isReviewedPostedByLastName> <isReviewedPostedByEmail>0</isReviewedPostedByEmail> <isReviewedPostedByMobile>0</isReviewedPostedByMobile> <isReviewedPostedByLand>0</isReviewedPostedByLand> </PostedBy> </DocumentElement> </diffgr:diffgram> </DataTable>

the data should be update in usershistory table and need to update in users table <isReviewedPostedByMobile>0</isReviewedPostedByMobile>

in them 0 should be updates to (1).How to do this one

P.V.P.MOhan

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-02-04 : 00:54:03
are the datatype of fields xml?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

mohan123
Constraint Violating Yak Guru

252 Posts

Posted - 2013-02-04 : 01:10:35
yeah visakh,
Cust_DataStaging_ID
Cust_ID
CreatedByEmpID
Date
SectionID
DataInXML
ReviewStatusID

the columns of both the tables are same and DataInXML is the columns i need to update in userhistory table and need to update in users table

<isReviewedPostedBy>0</isReviewedPostedBy> <isReviewedPostedByFirstName>0</isReviewedPostedByFirstName>

these type of data in XML data should be updated from 0 to 1.

P.V.P.MOhan
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-02-04 : 01:42:13
use modify() method.

http://msdn.microsoft.com/en-us/library/ms190675.aspx

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-02-04 : 01:47:03
also the xml you posted in initial thread is not well formed

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -