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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 how to update XML data in 2 table s
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

mohan123
Constraint Violating Yak Guru

India
252 Posts

Posted - 02/04/2013 :  00:44:20  Show Profile  Reply with Quote
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

India
52326 Posts

Posted - 02/04/2013 :  00:54:03  Show Profile  Reply with Quote
are the datatype of fields xml?

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

Go to Top of Page

mohan123
Constraint Violating Yak Guru

India
252 Posts

Posted - 02/04/2013 :  01:10:35  Show Profile  Reply with Quote
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

India
52326 Posts

Posted - 02/04/2013 :  01:42:13  Show Profile  Reply with Quote
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

India
52326 Posts

Posted - 02/04/2013 :  01:47:03  Show Profile  Reply with Quote
also the xml you posted in initial thread is not well formed

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

Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000