Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: SQL-Server-2008
Hi All,
 
Can you please help me out in Sql query that retrieve the data from a string(varchar) column which has xml data as content.
 
my table column has data like below xml
<Account AccountID="99999999">
  <Details AddressClientID="8888888" Status="INFORCE" AccountID="99999999" />
  <AnalysisCodeValue ObjectType="ACCOUNT" />
  <AccountFee AccountID="99999999" FeeID="TRUSTEEFEE" EffectiveFrom="2011-12-20" Frequency="M" DueDate="2012-10-20" PaidTo="2012-09-30" FeeOverride="NONE" CommissionOverride="NONE" Status="ACTIVE" StartDate="2011-12-20" />
  <Beneficiary>
    <Details AccountID="99999999" Relationship="LPR" Percentage="100.00" BeneficiaryNo="1" />
  </Beneficiary>
  <RelatedParty AccountID="99999999" ClientID="8888888" Relationship="OWNER" />
</Account>
 
My table looks like
table Name : temp1
col1 (pk) int
col2 (file path) Varchar (100)
col3 (xmldata) Varchar(1000).
 
Now i need to retrieve the data from third column, based on the attribute value. (i.e) From above xml( which is string column in the table), i need to search my table where RelationShip="LPR".
 
Thanks in advance.
 
Regards
Chiranjeevi
Posted 24-Mar-13 16:56pm
Comments
gvprabu at 25-Mar-13 1:12am
   
Check the link....
http://www.codeproject.com/Articles/16313/XML-data-type-tips-in-SQL-Server-2005
http://blog.sqlauthority.com/2012/04/27/sql-server-introduction-to-discovering-xml-data-type-methods-a-primer/

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 6,569
1 Sergey Alexandrovich Kryukov 6,168
2 DamithSL 5,228
3 Manas Bhardwaj 4,717
4 Maciej Los 4,150


Advertise | Privacy | Mobile
Web04 | 2.8.1411022.1 | Last Updated 24 Mar 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100