开发者

chaning the view/style of sql xml auto

i have the below peice of code (following on for my earlier question SQL How to list Columns in a Table as a Cursor Statement)

select 
    (select * from
        (select Narrative 
         from OfficeClientLedger
         where ptMatter=$Matter$ and ptTrans = 4) 
     as Disbursments for xml auto)

Which returns

<OFFICECLIENTLEDGER NARRATIVE="M0604/20 Cwm Taff NHS Trust Medical Records (C)"/>&开发者_开发知识库lt;OFFICECLIENTLEDGER NARRATIVE="M0604/210 Dr Purby Medeical Records (C)"/><OFFICECLIENTLEDGER NARRATIVE="M0604.20 Orchid Cellmark tld Fee"/><OFFICECLIENTLEDGER NARRATIVE="M0604/20 Parsons Dowd Psychological Ltd Assessment Fees"/><OFFICECLIENTLEDGER NARRATIVE="M0604/20 Dr R  Oretti Drug testing"/><OFFICECLIENTLEDGER NARRATIVE="M0604/20 Correction of MIssposting CQ 013524"/><OFFICECLIENTLEDGER NARRATIVE="M0604/20 Helen Blackler Assessment Fees (P) "/> 

However, I need it to bring me a list such as

M0604/20 Cwm Taff NHS Trust Medical Records (C)

M0604/210 Dr Purby Medeical Records (C)

M0604.20 Orchid Cellmark tld Fee

M0604/20 Parsons Dowd

M0604/20 Dr R Oretti Drug testing

M0604/20 Correction of MIssposting CQ 013524

M0604/20 Helen Blackler Assessment Fees (P)

any ideas? thanks


select
(select cast(Narrative as varchar(max))
from OfficeClientLedger
where ptMatter=$Matter$ and ptTrans = 4
as Disbursments for xml path(''), true)


You could use an XSL style sheet to change the format of the XML retrieved from SQL Server.

http://sqlxml.org/faqs.aspx?faq=99

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜