Click here to Skip to main content
15,900,258 members
Home / Discussions / Database
   

Database

 
QuestionSQL Server How to add and update element in xml data in table based on match found after search using xquery Pin
Mou_kol16-Nov-19 8:20
Mou_kol16-Nov-19 8:20 
My objective is to add and update data into xml element which store in table. i am weak in xquery to do it. so looking for help.

in my table each row has one field which store xml. suppose my xml data look like below one which store in my table

XML
<?xml version="1.0" encoding="utf-8"?>
<TickerBrokerStandardDateLineitem>
  <Ticker />
  <TickerID />
  <TickerBrokerStandardDateLineitemValues>
    <TickerBrokerStandardDateLineitemValue>
      <TabName>Consensus Model</TabName>
      <StandardDate>2010 FY</StandardDate>
      <XFundCode>TRIN</XFundCode>
      <BRTab></BRTab>
      <BRLineItem></BRLineItem>
      <StandardLineItem>Total Sales</StandardLineItem>
      <StandardValue></StandardValue>
      <ActualProvidedByCompany>NO</ActualProvidedByCompany>
    </TickerBrokerStandardDateLineitemValue>
    <TickerBrokerStandardDateLineitemValue>
      <TabName>Consensus Model</TabName>
      <StandardDate>2011 FY</StandardDate>
      <XFundCode>TRIN</XFundCode>
      <BRTab></BRTab>
      <BRLineItem></BRLineItem>
      <StandardLineItem>Total Sales</StandardLineItem>
      <StandardValue></StandardValue>
      <ActualProvidedByCompany>NO</ActualProvidedByCompany>
    </TickerBrokerStandardDateLineitemValue>
  </TickerBrokerStandardDateLineitemValues>
</TickerBrokerStandardDateLineitem>


now i have to update XFundCode in all records of xml data if my supplied TabName & StandardLineItem match those records.

also i have to add one element called ID=55 to each records if my supplied TabName & StandardLineItem match those records in xml data.

so i have two task that i have to add one element called ID = 55 to each records of xml data if my TabName & StandardLineItem found in those records of xml data.

also i have to update XFundCode element if my TabName & StandardLineItem found in those records of xml data.

Please give me xquery code which i can run in sql server to add & update element in xml data. thanks
QuestionPivoting in SQL Pin
Anandkumar Prajapati12-Nov-19 23:50
professionalAnandkumar Prajapati12-Nov-19 23:50 
AnswerRe: Pivoting in SQL Pin
Richard Deeming13-Nov-19 2:17
mveRichard Deeming13-Nov-19 2:17 
GeneralRe: Pivoting in SQL Pin
#realJSOP15-Nov-19 0:18
professional#realJSOP15-Nov-19 0:18 
QuestionHow to think in MongoDB/Mongoose ?! Pin
AlexanderKolarov7-Nov-19 11:33
AlexanderKolarov7-Nov-19 11:33 
Questiondatabase ER diagrime Pin
Member 1463562026-Oct-19 4:01
Member 1463562026-Oct-19 4:01 
AnswerRe: database ER diagrime Pin
OriginalGriff26-Oct-19 4:02
mveOriginalGriff26-Oct-19 4:02 
QuestionRe: database ER diagrime Pin
Member 1463562026-Oct-19 4:14
Member 1463562026-Oct-19 4:14 
AnswerRe: database ER diagrime Pin
Richard MacCutchan26-Oct-19 4:18
mveRichard MacCutchan26-Oct-19 4:18 
AnswerRe: database ER diagrime Pin
Victor Nijegorodov26-Oct-19 5:21
Victor Nijegorodov26-Oct-19 5:21 
AnswerRe: database ER diagrime Pin
Mycroft Holmes26-Oct-19 13:05
professionalMycroft Holmes26-Oct-19 13:05 
GeneralRe: database ER diagrime Pin
Richard MacCutchan26-Oct-19 21:46
mveRichard MacCutchan26-Oct-19 21:46 
QuestionFetch data Pin
Member 1463481125-Oct-19 2:34
Member 1463481125-Oct-19 2:34 
AnswerRe: Fetch data Pin
Richard Deeming25-Oct-19 2:58
mveRichard Deeming25-Oct-19 2:58 
QuestionRe: Fetch data Pin
ZurdoDev25-Oct-19 4:22
professionalZurdoDev25-Oct-19 4:22 
Questionc# MongoDB Driver, find all products that contain a single brand name, and Group Distinct all category names, then get those categories. Pin
jkirkerx22-Oct-19 10:25
professionaljkirkerx22-Oct-19 10:25 
AnswerRe: c# MongoDB Driver, find all products that contain a single brand name, and Group Distinct all category names, then get those categories. Pin
jkirkerx22-Oct-19 10:41
professionaljkirkerx22-Oct-19 10:41 
QuestionHow do you separate in pages database results? Pin
Joan M21-Oct-19 10:00
professionalJoan M21-Oct-19 10:00 
AnswerRe: How do you separate in pages database results? Pin
David Mujica23-Oct-19 2:48
David Mujica23-Oct-19 2:48 
QuestionI have a column and i need to find in which table this column exists throughout whole DB Pin
Anandkumar Prajapati8-Oct-19 19:29
professionalAnandkumar Prajapati8-Oct-19 19:29 
AnswerRe: I have a column and i need to find in which table this column exists throughout whole DB Pin
Victor Nijegorodov8-Oct-19 20:46
Victor Nijegorodov8-Oct-19 20:46 
AnswerRe: I have a column and i need to find in which table this column exists throughout whole DB Pin
Jörgen Andersson8-Oct-19 21:11
professionalJörgen Andersson8-Oct-19 21:11 
Questionvb.net connection to a firebird database Pin
Member 767827622-Sep-19 17:15
Member 767827622-Sep-19 17:15 
AnswerRe: vb.net connection to a firebird database Pin
Victor Nijegorodov22-Sep-19 20:12
Victor Nijegorodov22-Sep-19 20:12 
GeneralRe: vb.net connection to a firebird database Pin
Member 767827623-Sep-19 11:06
Member 767827623-Sep-19 11:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.