Click here to Skip to main content
14,267,453 members
   

Database

 
Questioncookies vs sessions for storing users id for ecommerce site Pin
djtrixy2-Aug-19 21:48
memberdjtrixy2-Aug-19 21:48 
AnswerRe: cookies vs sessions for storing users id for ecommerce site Pin
Afzaal Ahmad Zeeshan3-Aug-19 4:02
mveAfzaal Ahmad Zeeshan3-Aug-19 4:02 
QuestionI didn't design it but I need to get data out of it. Pin
rnbergren2-Aug-19 4:23
memberrnbergren2-Aug-19 4:23 
AnswerRe: I didn't design it but I need to get data out of it. Pin
Richard Deeming2-Aug-19 4:51
mveRichard Deeming2-Aug-19 4:51 
GeneralRe: I didn't design it but I need to get data out of it. Pin
rnbergren2-Aug-19 8:12
memberrnbergren2-Aug-19 8:12 
AnswerRe: I didn't design it but I need to get data out of it. Pin
ZurdoDev2-Aug-19 10:33
professionalZurdoDev2-Aug-19 10:33 
AnswerRe: I didn't design it but I need to get data out of it. Pin
Mycroft Holmes2-Aug-19 13:40
memberMycroft Holmes2-Aug-19 13:40 
QuestionSQL Server: Facing problem to parse xml using xquery Pin
Mou_kol31-Jul-19 5:56
memberMou_kol31-Jul-19 5:56 
I am generating xml from my C# application which look like

<Broker Code=\"ML\" IsAllowEstimate=\"False\" ReviseDate=\"01-16-2018\" BrokerEarnings=\"4Q2017 Pre\" BrokerName=\"BofA Merrill Lynch\"></Broker>
<TickerBrokerStandardDateLineitem>
  <Ticker />
  <TickerID />
  <TickerBrokerStandardDateLineitemValues>
    <TickerBrokerStandardDateLineitemValue>
      <TabName>Consensus Model</TabName>
      <StandardDate>1Q 2010</StandardDate>
      <BRTab>Income Statement</BRTab>
      <BRLineItem>NET REVENUES</BRLineItem>
      <Action>Extracted</Action>
      <StandardLineItem>Net Revenue</StandardLineItem>
      <StandardValue>329.623</StandardValue>
    </TickerBrokerStandardDateLineitemValue>
</TickerBrokerStandardDateLineitemValues>
</TickerBrokerStandardDateLineitem>	
</Broker>


i guess due to \" character sql server not able to parse my xml. i tried lot to remove back slash from my xml in c# but failed.

so tell me what kind of changes i can do in my below xquery code as a result \" will not cause any problem

here is my full code

Declare @BrokerBogeyXML xml='
<Broker Code=\"ML\" IsAllowEstimate=\"False\" ReviseDate=\"01-16-2018\" BrokerEarnings=\"4Q2017 Pre\" BrokerName=\"BofA Merrill Lynch\">
<TickerBrokerStandardDateLineitem>
  <Ticker />
  <TickerID />
  <TickerBrokerStandardDateLineitemValues>
    <TickerBrokerStandardDateLineitemValue>
      <TabName>Consensus Model</TabName>
      <StandardDate>1Q 2010</StandardDate>
      <BRTab>Income Statement</BRTab>
      <BRLineItem>NET REVENUES</BRLineItem>
      <Action>Extracted</Action>
      <StandardLineItem>Net Revenue</StandardLineItem>
      <StandardValue>329.623</StandardValue>
    </TickerBrokerStandardDateLineitemValue>
    <TickerBrokerStandardDateLineitemValue>
      <TabName>Consensus Model</TabName>
      <StandardDate>2Q 2010</StandardDate>
      <BRTab>Income Statement</BRTab>
      <BRLineItem>NET REVENUES</BRLineItem>
      <Action>Extracted</Action>
      <StandardLineItem>Net Revenue</StandardLineItem>
      <StandardValue>454.776</StandardValue>
    </TickerBrokerStandardDateLineitemValue>
</TickerBrokerStandardDateLineitemValues>
</TickerBrokerStandardDateLineitem>	
</Broker>
<Broker Code=\"ML\" IsAllowEstimate=\"False\" ReviseDate=\"01-16-2018\" BrokerEarnings=\"4Q2017 Pre\" BrokerName=\"BofA Merrill Lynch\">
<TickerBrokerStandardDateLineitem>
  <Ticker />
  <TickerID />
  <TickerBrokerStandardDateLineitemValues>
    <TickerBrokerStandardDateLineitemValue>
      <TabName>Consensus Model</TabName>
      <StandardDate>1Q 2010</StandardDate>
      <BRTab>TER</BRTab>
      <BRLineItem>Revenue</BRLineItem>
      <Action>Extracted</Action>
      <StandardLineItem>Net Revenue</StandardLineItem>
      <StandardValue>319.338</StandardValue>
    </TickerBrokerStandardDateLineitemValue>
    <TickerBrokerStandardDateLineitemValue>
      <TabName>Consensus Model</TabName>
      <StandardDate>2Q 2010</StandardDate>
      <BRTab>TER</BRTab>
      <BRLineItem>Revenue</BRLineItem>
      <Action>Extracted</Action>
      <StandardLineItem>Net Revenue</StandardLineItem>
      <StandardValue>445.271</StandardValue>
    </TickerBrokerStandardDateLineitemValue>
</TickerBrokerStandardDateLineitemValues>
</TickerBrokerStandardDateLineitem>		
</Broker>
'  
				SELECT 
				d.v.value('../../../@Code[1]', 'varchar(MAX)') AS BrokerCode,
				d.v.value('../../../@IsAllowEstimate[1]', 'varchar(MAX)') AS IsAllowEstimate,
				d.v.value('../../../@ReviseDate[1]', 'varchar(MAX)') AS ReviseDate,
				d.v.value('../../../@BrokerEarnings[1]', 'varchar(MAX)') AS BrokerEarnings,
				d.v.value('../../../@BrokerName[1]', 'varchar(MAX)') AS BrokerName,
				d.v.value('(TabName/text())[1]','VARCHAR(MAX)') AS TabName,
				d.v.value('(StandardDate/text())[1]','VARCHAR(MAX)') AS StandardDate,
				d.v.value('(BRTab/text())[1]','VARCHAR(MAX)') AS BRTab,
				d.v.value('(BRLineItem/text())[1]','VARCHAR(MAX)') AS BRLineItem,
				d.v.value('(Action/text())[1]','VARCHAR(MAX)') AS Action,
				d.v.value('(StandardLineItem/text())[1]','VARCHAR(MAX)') AS StandardLineItem,
				d.v.value('(StandardValue/text())[1]','VARCHAR(MAX)') AS StandardValue,
				'192.16820.25' AS IPAddress
				FROM @BrokerBogeyXML.nodes('/Broker/TickerBrokerStandardDateLineitem/TickerBrokerStandardDateLineitemValues/TickerBrokerStandardDateLineitemValue') AS d(v)


getting this error 
XML parsing: line 2, character 14, A string literal was expected


when i change this one
<Broker Code=\"ML\" IsAllowEstimate=\"False\" ReviseDate=\"01-16-2018\" BrokerEarnings=\"4Q2017 Pre\" BrokerName=\"BofA Merrill Lynch\"></Broker>
to
<Broker Code="ML" IsAllowEstimate="False" ReviseDate="01-16-2018" BrokerEarnings="4Q2017 Pre" BrokerName="BofA Merrill Lynch" >


then my above code works fine.

please give me solution.
QuestionMessage Closed Pin
22-Jul-19 1:59
memberjohnwilliamsonn0922-Jul-19 1:59 
GeneralMessage Closed Pin
19-Jul-19 20:29
memberAbdulrahman Kalari19-Jul-19 20:29 
QuestionMessage Closed Pin
19-Jul-19 0:15
memberMember 1453550719-Jul-19 0:15 
Questionstructure question 2 Pin
Joan M18-Jul-19 21:25
professionalJoan M18-Jul-19 21:25 
AnswerRe: structure question 2 Pin
Richard Deeming19-Jul-19 1:11
mveRichard Deeming19-Jul-19 1:11 
GeneralRe: structure question 2 Pin
Joan M19-Jul-19 1:14
professionalJoan M19-Jul-19 1:14 
GeneralRe: structure question 2 Pin
Richard Deeming19-Jul-19 1:27
mveRichard Deeming19-Jul-19 1:27 
PraiseRe: structure question 2 Pin
Joan M19-Jul-19 1:31
professionalJoan M19-Jul-19 1:31 
QuestionBest practices for database tables. Pin
RLD7114-Jul-19 12:37
professionalRLD7114-Jul-19 12:37 
AnswerRe: Best practices for database tables. Pin
CHill6017-Jul-19 23:17
protectorCHill6017-Jul-19 23:17 
AnswerRe: Best practices for database tables. Pin
Mycroft Holmes18-Jul-19 11:57
memberMycroft Holmes18-Jul-19 11:57 
GeneralRe: Best practices for database tables. Pin
RLD7121-Jul-19 3:37
professionalRLD7121-Jul-19 3:37 
Questionstructure question Pin
Joan M11-Jul-19 1:30
professionalJoan M11-Jul-19 1:30 
AnswerRe: structure question Pin
Eddy Vluggen11-Jul-19 2:01
mveEddy Vluggen11-Jul-19 2:01 
GeneralRe: structure question Pin
CHill6018-Jul-19 1:30
protectorCHill6018-Jul-19 1:30 
GeneralRe: structure question Pin
Eddy Vluggen18-Jul-19 22:53
mveEddy Vluggen18-Jul-19 22:53 
QuestionQuery numbering in groups in access database ? Pin
Member 24584674-Jul-19 23:50
memberMember 24584674-Jul-19 23:50 

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.