<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	
	>
<channel>
	<title>
	Comments on: Handling special characters with FOR XML PATH(&#8221;)	</title>
	<atom:link href="https://lobsterpot.com.au/blog/2010/04/15/handling-special-characters-with-for-xml-path/feed/" rel="self" type="application/rss+xml" />
	<link>https://lobsterpot.com.au/blog/2010/04/15/handling-special-characters-with-for-xml-path/</link>
	<description></description>
	<lastBuildDate>Tue, 07 Jun 2022 08:46:24 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>
		By: neha		</title>
		<link>https://lobsterpot.com.au/blog/2010/04/15/handling-special-characters-with-for-xml-path/#comment-1365</link>

		<dc:creator><![CDATA[neha]]></dc:creator>
		<pubDate>Mon, 17 Jul 2017 10:38:02 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.lobsterpot.com.au/?p=2699#comment-1365</guid>

					<description><![CDATA[STUFF((
 &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; SELECT &#039;#!&#039; + RTRIM(x.PersonInstnAlias)
 &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;FROM ObjectViews.dbo.LookupPersonInstnAlias x
 &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;WHERE x.KeyPersonInstnAlias = x2_0.KeyPersonInstnAlias
 &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;ORDER BY x.KeyPersonInstnAlias
 &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;FOR XML PATH(&#039;&#039;) , &#160;root(&#039;x.PersonInstnAlias&#039;)
 &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; ,TYPE
 &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;).value(&#039;.&#039;, &#039;varchar(max)&#039;), 1, 2, &#039;&#039;) AS PersonInstnAlias
Hi my piece of code is this . 
FOR XML could not serialize the data for node &#039;NoName&#039; because it contains a character (0x001C) which is not allowed in XML. To retrieve this data using FOR XML, convert it to binary, varbinary or image data type and use the BINARY BASE64 directive.
and I am getting this error . please can anyone help ?
Its very important .
Thanks .]]></description>
			<content:encoded><![CDATA[<p>STUFF((<br />
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SELECT &#8216;#!&#8217; + RTRIM(x.PersonInstnAlias)<br />
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;FROM ObjectViews.dbo.LookupPersonInstnAlias x<br />
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;WHERE x.KeyPersonInstnAlias = x2_0.KeyPersonInstnAlias<br />
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ORDER BY x.KeyPersonInstnAlias<br />
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;FOR XML PATH(&#8221;) , &nbsp;root(&#8216;x.PersonInstnAlias&#8217;)<br />
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ,TYPE<br />
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;).value(&#8216;.&#8217;, &#8216;varchar(max)&#8217;), 1, 2, &#8221;) AS PersonInstnAlias<br />
Hi my piece of code is this .<br />
FOR XML could not serialize the data for node &#8216;NoName&#8217; because it contains a character (0x001C) which is not allowed in XML. To retrieve this data using FOR XML, convert it to binary, varbinary or image data type and use the BINARY BASE64 directive.<br />
and I am getting this error . please can anyone help ?<br />
Its very important .<br />
Thanks .</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Rodf1021		</title>
		<link>https://lobsterpot.com.au/blog/2010/04/15/handling-special-characters-with-for-xml-path/#comment-1364</link>

		<dc:creator><![CDATA[Rodf1021]]></dc:creator>
		<pubDate>Sat, 17 Jun 2017 01:50:36 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.lobsterpot.com.au/?p=2699#comment-1364</guid>

					<description><![CDATA[This is GREAT!! It got me really close to what I need. Wondering if you can advise on why it correctly returns the &#060;ItemMaster&#062; node with all elements surrounded by &#039;&#060;&#039; and &#039;&#062;&#039;, but leaves out the root node and its attributes.
Return should be Filename, XML where XML is a string literal with a valid XML. The SQL below returns the correct XML but has the &#039;&#038;gt;&#039; and &#039;&#038;lt;&#039;. 
Value of XML column
&#060;?xml version=&#034;1.0&#034; encoding=&#034;utf-8&#034;?&#062;&#060;Root TransactionType=&#034;ItemMasterDownload&#034; TransactionDateTime=&#034;2017-06-16T15:45:35-07:00&#034; SystemID=&#034;DraperMES&#034; Environment=&#034;JDE_CRP&#034; MessageID=&#034;FCCBC642-4EC9-4478-B176-47857760E7CB&#034;&#062;&#060;ItemMaster&#062;&#060;Plant&#062;&#038;lt;![CDATA[UT02]]&#038;gt;&#060;/Plant&#062;&#060;ItemNumber&#062;&#038;lt;![CDATA[ROD_FG]]&#038;gt;&#060;/ItemNumber&#062;&#060;ItemRev&#062;&#038;lt;![CDATA[N/A]]&#038;gt;&#060;/ItemRev&#062;&#060;ItemDescription&#062;&#038;lt;![CDATA[RodF FG test item]]&#038;gt;&#060;/ItemDescription&#062;&#060;UOM&#062;&#038;lt;![CDATA[EA]]&#038;gt;&#060;/UOM&#062;&#060;Family&#062;&#038;lt;![CDATA[TBV]]&#038;gt;&#060;/Family&#062;&#060;Type&#062;&#038;lt;![CDATA[S]]&#038;gt;&#060;/Type&#062;&#060;IBUserReserveRef&#062;&#038;lt;![CDATA[]]&#038;gt;&#060;/IBUserReserveRef&#062;&#060;/ItemMaster&#062;&#060;/Root&#062;
SQL statement excluding the create of CTE x
SELECT 
Convert(varchar(10),GetDate(),120) + &#039;_ManualItemSubscription_&#039; + x.ItemNumber +&#039;.xml&#039; &#039;Filename&#039;
, &#039;&#060;?xml version=&#034;1.0&#034; encoding=&#034;utf-8&#034;?&#062;&#039; + (
select
&#039;ItemMasterDownload&#039; &#039;@TransactionType&#039;
, Substring(replace(convert(varchar,sysdatetimeoffset(),120),&#039; &#039;,&#039;T&#039;),1,charindex(&#039;T&#039;,replace(convert(varchar,sysdatetimeoffset(),120),&#039; &#039;,&#039;T&#039;),12)-1) 
	+ right(replace(convert(varchar,sysdatetimeoffset(),120),&#039; &#039;,&#039;T&#039;),6) &#039;@TransactionDateTime&#039;
, &#039;DraperMES&#039; &#039;@SystemID&#039;
, DB_Name() &#039;@Environment&#039;
, newid() &#039;@MessageID&#039;
,(
	SELECT 
	&#039;&#060;![CDATA[&#039; + X.PLANT &#160;+ &#039;]]&#062;&#039; &#039;Plant&#039;
	, &#039;&#060;![CDATA[&#039; + X.ITEMNUMBER &#160;+ &#039;]]&#062;&#039; &#039;ItemNumber&#039;
	, &#039;&#060;![CDATA[&#039; + x.ItemRev &#160;+ &#039;]]&#062;&#039; &#039;ItemRev&#039;
	, &#039;&#060;![CDATA[&#039; + x.ItemDescription &#160;+ &#039;]]&#062;&#039; &#039;ItemDescription&#039;
	, &#039;&#060;![CDATA[&#039; + x.UOM &#160;+ &#039;]]&#062;&#039; &#039;UOM&#039;
	, &#039;&#060;![CDATA[&#039; + x.Family &#160;+ &#039;]]&#062;&#039; &#039;Family&#039;
	, &#039;&#060;![CDATA[&#039; + x.[Type] &#160;+ &#039;]]&#062;&#039; &#039;Type&#039;
	, &#039;&#060;![CDATA[&#039; + x.IBUserReserveRef &#160;+ &#039;]]&#062;&#039; &#039;IBUserReserveRef&#039;
	FOR XML PATH (&#039;ItemMaster&#039;), TYPE
 ) 
FOR XML PATH (&#039;Root&#039;)
) &#039;XML&#039;
FROM x
When I implement your solution, it executes, but returns the following:
&#060;?xml version=&#034;1.0&#034; encoding=&#034;utf-8&#034;?&#062;&#060;![CDATA[UT02]]&#062;&#060;![CDATA[ROD_FG]]&#062;&#060;![CDATA[N/A]]&#062;&#060;![CDATA[RodF FG test item]]&#062;&#060;![CDATA[EA]]&#062;&#060;![CDATA[TBV]]&#062;&#060;![CDATA[S]]&#062;&#060;![CDATA[]]&#062;
Here is the SQL used to get the return above:
SELECT 
Convert(varchar(10),GetDate(),120) + &#039;_ManualItemSubscription_&#039; + x.ItemNumber +&#039;.xml&#039; &#039;Filename&#039;
, &#039;&#060;?xml version=&#034;1.0&#034; encoding=&#034;utf-8&#034;?&#062;&#039; + (
select
&#039;ItemMasterDownload&#039; &#039;@TransactionType&#039;
, Substring(replace(convert(varchar,sysdatetimeoffset(),120),&#039; &#039;,&#039;T&#039;),1,charindex(&#039;T&#039;,replace(convert(varchar,sysdatetimeoffset(),120),&#039; &#039;,&#039;T&#039;),12)-1) 
	+ right(replace(convert(varchar,sysdatetimeoffset(),120),&#039; &#039;,&#039;T&#039;),6) &#039;@TransactionDateTime&#039;
, &#039;DraperMES&#039; &#039;@SystemID&#039;
, DB_Name() &#039;@Environment&#039;
, newid() &#039;@MessageID&#039;
,(
	SELECT 
	&#039;&#060;![CDATA[&#039; + X.PLANT &#160;+ &#039;]]&#062;&#039; &#039;Plant&#039;
	, &#039;&#060;![CDATA[&#039; + X.ITEMNUMBER &#160;+ &#039;]]&#062;&#039; &#039;ItemNumber&#039;
	, &#039;&#060;![CDATA[&#039; + x.ItemRev &#160;+ &#039;]]&#062;&#039; &#039;ItemRev&#039;
	, &#039;&#060;![CDATA[&#039; + x.ItemDescription &#160;+ &#039;]]&#062;&#039; &#039;ItemDescription&#039;
	, &#039;&#060;![CDATA[&#039; + x.UOM &#160;+ &#039;]]&#062;&#039; &#039;UOM&#039;
	, &#039;&#060;![CDATA[&#039; + x.Family &#160;+ &#039;]]&#062;&#039; &#039;Family&#039;
	, &#039;&#060;![CDATA[&#039; + x.[Type] &#160;+ &#039;]]&#062;&#039; &#039;Type&#039;
	, &#039;&#060;![CDATA[&#039; + x.IBUserReserveRef &#160;+ &#039;]]&#062;&#039; &#039;IBUserReserveRef&#039;
	FOR XML PATH (&#039;ItemMaster&#039;), TYPE
 ) 
FOR XML PATH (&#039;Root&#039;),Type
).value(&#039;/Root[1]&#039;,&#039;nvarchar(max)&#039;) &#039;XML&#039;
FROM x]]></description>
			<content:encoded><![CDATA[<p>This is GREAT!! It got me really close to what I need. Wondering if you can advise on why it correctly returns the &lt;ItemMaster&gt; node with all elements surrounded by &#8216;&lt;&#8216; and &#8216;&gt;&#8217;, but leaves out the root node and its attributes.<br />
Return should be Filename, XML where XML is a string literal with a valid XML. The SQL below returns the correct XML but has the &#8216;&amp;gt;&#8217; and &#8216;&amp;lt;&#8217;.<br />
Value of XML column<br />
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;&lt;Root TransactionType=&quot;ItemMasterDownload&quot; TransactionDateTime=&quot;2017-06-16T15:45:35-07:00&quot; SystemID=&quot;DraperMES&quot; Environment=&quot;JDE_CRP&quot; MessageID=&quot;FCCBC642-4EC9-4478-B176-47857760E7CB&quot;&gt;&lt;ItemMaster&gt;&lt;Plant&gt;&amp;lt;![CDATA[UT02]]&amp;gt;&lt;/Plant&gt;&lt;ItemNumber&gt;&amp;lt;![CDATA[ROD_FG]]&amp;gt;&lt;/ItemNumber&gt;&lt;ItemRev&gt;&amp;lt;![CDATA[N/A]]&amp;gt;&lt;/ItemRev&gt;&lt;ItemDescription&gt;&amp;lt;![CDATA[RodF FG test item]]&amp;gt;&lt;/ItemDescription&gt;&lt;UOM&gt;&amp;lt;![CDATA[EA]]&amp;gt;&lt;/UOM&gt;&lt;Family&gt;&amp;lt;![CDATA[TBV]]&amp;gt;&lt;/Family&gt;&lt;Type&gt;&amp;lt;![CDATA[S]]&amp;gt;&lt;/Type&gt;&lt;IBUserReserveRef&gt;&amp;lt;![CDATA[]]&amp;gt;&lt;/IBUserReserveRef&gt;&lt;/ItemMaster&gt;&lt;/Root&gt;<br />
SQL statement excluding the create of CTE x<br />
SELECT<br />
Convert(varchar(10),GetDate(),120) + &#8216;_ManualItemSubscription_&#8217; + x.ItemNumber +&#8217;.xml&#8217; &#8216;Filename&#8217;<br />
, &#8216;&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;&#8217; + (<br />
select<br />
&#8216;ItemMasterDownload&#8217; &#8216;@TransactionType&#8217;<br />
, Substring(replace(convert(varchar,sysdatetimeoffset(),120),&#8217; &#8216;,&#8217;T&#8217;),1,charindex(&#8216;T&#8217;,replace(convert(varchar,sysdatetimeoffset(),120),&#8217; &#8216;,&#8217;T&#8217;),12)-1)<br />
	+ right(replace(convert(varchar,sysdatetimeoffset(),120),&#8217; &#8216;,&#8217;T&#8217;),6) &#8216;@TransactionDateTime&#8217;<br />
, &#8216;DraperMES&#8217; &#8216;@SystemID&#8217;<br />
, DB_Name() &#8216;@Environment&#8217;<br />
, newid() &#8216;@MessageID&#8217;<br />
,(<br />
	SELECT<br />
	&#8216;&lt;![CDATA[&#8216; + X.PLANT &nbsp;+ &#8216;]]&gt;&#8217; &#8216;Plant&#8217;<br />
	, &#8216;&lt;![CDATA[&#8216; + X.ITEMNUMBER &nbsp;+ &#8216;]]&gt;&#8217; &#8216;ItemNumber&#8217;<br />
	, &#8216;&lt;![CDATA[&#8216; + x.ItemRev &nbsp;+ &#8216;]]&gt;&#8217; &#8216;ItemRev&#8217;<br />
	, &#8216;&lt;![CDATA[&#8216; + x.ItemDescription &nbsp;+ &#8216;]]&gt;&#8217; &#8216;ItemDescription&#8217;<br />
	, &#8216;&lt;![CDATA[&#8216; + x.UOM &nbsp;+ &#8216;]]&gt;&#8217; &#8216;UOM&#8217;<br />
	, &#8216;&lt;![CDATA[&#8216; + x.Family &nbsp;+ &#8216;]]&gt;&#8217; &#8216;Family&#8217;<br />
	, &#8216;&lt;![CDATA[&#8216; + x.[Type] &nbsp;+ &#8216;]]&gt;&#8217; &#8216;Type&#8217;<br />
	, &#8216;&lt;![CDATA[&#8216; + x.IBUserReserveRef &nbsp;+ &#8216;]]&gt;&#8217; &#8216;IBUserReserveRef&#8217;<br />
	FOR XML PATH (&#8216;ItemMaster&#8217;), TYPE<br />
 )<br />
FOR XML PATH (&#8216;Root&#8217;)<br />
) &#8216;XML&#8217;<br />
FROM x<br />
When I implement your solution, it executes, but returns the following:<br />
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;&lt;![CDATA[UT02]]&gt;&lt;![CDATA[ROD_FG]]&gt;&lt;![CDATA[N/A]]&gt;&lt;![CDATA[RodF FG test item]]&gt;&lt;![CDATA[EA]]&gt;&lt;![CDATA[TBV]]&gt;&lt;![CDATA[S]]&gt;&lt;![CDATA[]]&gt;<br />
Here is the SQL used to get the return above:<br />
SELECT<br />
Convert(varchar(10),GetDate(),120) + &#8216;_ManualItemSubscription_&#8217; + x.ItemNumber +&#8217;.xml&#8217; &#8216;Filename&#8217;<br />
, &#8216;&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;&#8217; + (<br />
select<br />
&#8216;ItemMasterDownload&#8217; &#8216;@TransactionType&#8217;<br />
, Substring(replace(convert(varchar,sysdatetimeoffset(),120),&#8217; &#8216;,&#8217;T&#8217;),1,charindex(&#8216;T&#8217;,replace(convert(varchar,sysdatetimeoffset(),120),&#8217; &#8216;,&#8217;T&#8217;),12)-1)<br />
	+ right(replace(convert(varchar,sysdatetimeoffset(),120),&#8217; &#8216;,&#8217;T&#8217;),6) &#8216;@TransactionDateTime&#8217;<br />
, &#8216;DraperMES&#8217; &#8216;@SystemID&#8217;<br />
, DB_Name() &#8216;@Environment&#8217;<br />
, newid() &#8216;@MessageID&#8217;<br />
,(<br />
	SELECT<br />
	&#8216;&lt;![CDATA[&#8216; + X.PLANT &nbsp;+ &#8216;]]&gt;&#8217; &#8216;Plant&#8217;<br />
	, &#8216;&lt;![CDATA[&#8216; + X.ITEMNUMBER &nbsp;+ &#8216;]]&gt;&#8217; &#8216;ItemNumber&#8217;<br />
	, &#8216;&lt;![CDATA[&#8216; + x.ItemRev &nbsp;+ &#8216;]]&gt;&#8217; &#8216;ItemRev&#8217;<br />
	, &#8216;&lt;![CDATA[&#8216; + x.ItemDescription &nbsp;+ &#8216;]]&gt;&#8217; &#8216;ItemDescription&#8217;<br />
	, &#8216;&lt;![CDATA[&#8216; + x.UOM &nbsp;+ &#8216;]]&gt;&#8217; &#8216;UOM&#8217;<br />
	, &#8216;&lt;![CDATA[&#8216; + x.Family &nbsp;+ &#8216;]]&gt;&#8217; &#8216;Family&#8217;<br />
	, &#8216;&lt;![CDATA[&#8216; + x.[Type] &nbsp;+ &#8216;]]&gt;&#8217; &#8216;Type&#8217;<br />
	, &#8216;&lt;![CDATA[&#8216; + x.IBUserReserveRef &nbsp;+ &#8216;]]&gt;&#8217; &#8216;IBUserReserveRef&#8217;<br />
	FOR XML PATH (&#8216;ItemMaster&#8217;), TYPE<br />
 )<br />
FOR XML PATH (&#8216;Root&#8217;),Type<br />
).value(&#8216;/Root[1]&#8217;,&#8217;nvarchar(max)&#8217;) &#8216;XML&#8217;<br />
FROM x</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Matt		</title>
		<link>https://lobsterpot.com.au/blog/2010/04/15/handling-special-characters-with-for-xml-path/#comment-1363</link>

		<dc:creator><![CDATA[Matt]]></dc:creator>
		<pubDate>Tue, 06 Jun 2017 22:24:32 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.lobsterpot.com.au/?p=2699#comment-1363</guid>

					<description><![CDATA[This is still great. 7 years on people are still finding this immensely helpful and informative!]]></description>
			<content:encoded><![CDATA[<p>This is still great. 7 years on people are still finding this immensely helpful and informative!</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Stephen		</title>
		<link>https://lobsterpot.com.au/blog/2010/04/15/handling-special-characters-with-for-xml-path/#comment-1362</link>

		<dc:creator><![CDATA[Stephen]]></dc:creator>
		<pubDate>Mon, 19 Dec 2016 22:09:18 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.lobsterpot.com.au/?p=2699#comment-1362</guid>

					<description><![CDATA[Lol, people straight up giving you their entire issues to solve... contracting isn&#039;t free people!
Great post, worked out nicely.]]></description>
			<content:encoded><![CDATA[<p>Lol, people straight up giving you their entire issues to solve&#8230; contracting isn&#8217;t free people!<br />
Great post, worked out nicely.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: percussionies		</title>
		<link>https://lobsterpot.com.au/blog/2010/04/15/handling-special-characters-with-for-xml-path/#comment-1361</link>

		<dc:creator><![CDATA[percussionies]]></dc:creator>
		<pubDate>Tue, 06 Sep 2016 10:43:23 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.lobsterpot.com.au/?p=2699#comment-1361</guid>

					<description><![CDATA[select a.list from (
select(
SELECT 
PROPERTY_ID 
AUCTION_ID,
CASE_NO AS CaseNumber, 
PROCEEDING_ID ,
FC_STATE_CD, &#160;
LAND_TITLE, 
RESTRICTION_IN_INTEREST,
RESERVED_PRICE, 1 as PropertyInAuction, COURT_LOCATION_NAME, PROCEEDING_DATE AS AuctionDate, 1 AS NumberOfAuction, MINIMUM_BID AS MinimumBid, DEPOSIT_PERCENTAGE AS DepositPercentage,
PANEL_BANK_PROCESSING_FEE AS PanelBankProcessingFee, STAMP_DUTY AS StampDuty, PAYMENT_TERMS AS PaymentTerm, COUNSEL_ID AS CounsellorId, ATTACHMENT_PATH AS DocumentId, 0 AS STATUS, GETDATE() AS CreatedDate, 
1 AS CreatedBy, GETDATE() AS ModifiedDate, 1 AS ModifiedBy,
		(
					SELECT DISTINCT
					PR.PROPERTY_ID,
					AD.AUCTION_ID,
					CD.CASE_NO AS [Property/CaseNumber],
					CE.PROCEEDING_ID AS [Property/ProceedingId],
					PR.PROPERTY_ID AS [Property/PropertyId],
					PR.TITLE_NUMBER AS [Property/TitleNumber],
					PR.BANK_NAME AS [Property/BankName],
					PR.MUKIM AS [Property/Mukim], 
					PR.DISTRICT AS [Property/District],
					PR.LOT_NUMBER AS [Property/LotNumber],
					PR.PARCEL_NUMBER AS [Property/ParcelNumber],
					PR.STORY_NUMBER AS [Property/StoreyNumber],
					PR.BUILDING_NUMBER AS [Property/BuildingNumber],
					PR.EXPRESS_CONDITION AS [Property/ExpressCondition],
					PR.TENURE AS [Property/Tenure],
					PR.BUILT_UP AS [Property/BuiltUp],
					PR.LAND_AREA AS [Property/LandArea],
					PR.REGISTER_OWNER AS [Property/RegisterOwner],
					PR.FACILITIES AS [Property/Facilities],
					PR.EMCUMBRANCES AS [Property/Emcumbrances],
					PR.PROPERTY_TYPE AS [Property/PropertyType],
					PR.UNIT_NUMBER AS [Property/UnitNumber],
					PR.FLOOR AS [Property/Floor],
					PR.BUILDING_NAME AS [Property/BuildingName], 
					PR.STREET AS [Property/Street],
					PR.SECTION AS [Property/Section],
					PR.POST_CD AS [Property/Postcode],
					PR.CITY AS [Property/City],
					PR.POSTAL_STATE_CD AS [Property/PostalStatecode],
					GETDATE() AS [Property/CreatedDate], 
					1 AS [Property/CreatedBy], 
					GETDATE() AS [Property/ModifiedDate], 
					1 AS [Property/ModifiedBy] 
					from TBL_CASE_DETAIL cd WITH(NOLOCK) 
					inner join TBL_AUCTION_DETAIL AD on AD.CASE_DETAIL_ID = cd.CASE_DETAIL_ID
					LEFT JOIN TBL_AUCTION_PROPERTY_MAPPING TAPM WITH(NOLOCK) ON TAPM.AUCTION_ID = AD.AUCTION_ID
					LEFT JOIN TBL_PROPERTY PR WITH(NOLOCK) ON PR.PROPERTY_ID = TAPM.PROPERTY_ID
					LEFT JOIN TBL_AUCTION_PROCEEDING_MAPPING APM WITH(NOLOCK) ON APM.AUCTION_ID = AD.AUCTION_ID
					LEFT JOIN TBL_PROCEEDING CE WITH(NOLOCK) &#160;ON CE.PROCEEDING_ID = APM.PROCEEDING_ID
					LEFT JOIN TBL_PROPERTY_PARTY_MAPPING PPM WITH(NOLOCK) ON PPM.PROPERTY_ID = PR.PROPERTY_ID
					LEFT JOIN TBL_PARTY PA WITH(NOLOCK) ON PA.PARTY_ID = PPM.PARTY_ID
					LEFT JOIN TBL_CASE_DETAIL_PARTY_MAPPING CDPM WITH(NOLOCK) ON CDPM.CASE_DETAIL_ID = CD.CASE_DETAIL_ID
					LEFT JOIN TBL_CASE_DETAIL_PARTY_COUNSEL_REPRESENT CDPCR WITH(NOLOCK) ON CDPCR.CASE_DETAIL_PARTY_DETAIL_ID = CDPM.CASE_DETAIL_ID
					LEFT JOIN COMMON.dbo.TBL_COURT &#160;C WITH(NOLOCK) ON C.COURT_ID = CD.COURT_ID
					LEFT JOIN COMMON.dbo.VIEW_SELT_COURT_LOCATION vSCL ON vSCL.COURT_LOCATION_ID = C.COURT_LOCATION_ID
					WHERE &#160;tPR.PROPERTY_ID = PR.PROPERTY_ID AND CULTURE_CODE = &#039;ms-MY&#039;
					FOR XML PATH(&#039;&#039;), TYPE
			)
			from 
						(SELECT DISTINCT tPR.PROPERTY_ID, TAD.AUCTION_ID, aude.CASE_NO, CE.PROCEEDING_ID ,tPR.FC_STATE_CD, &#160;tPR.LAND_TITLE, tPR.RESTRICTION_IN_INTEREST,
						TAD.RESERVED_PRICE, 1 as PropertyInAuction,vSCL.COURT_LOCATION_NAME, CE.PROCEEDING_DATE , 1 AS NumberOfAuction, TAD.MINIMUM_BID, TAD.DEPOSIT_PERCENTAGE,
						PANEL_BANK_PROCESSING_FEE, STAMP_DUTY, PAYMENT_TERMS, COUNSEL_ID, ATTACHMENT_PATH, 0 AS STATUS, GETDATE() AS CreatedDate, 
						1 AS CreatedBy, GETDATE() AS ModifiedDate, 1 AS ModifiedBy &#160;from TBL_CASE_DETAIL aude
						inner join TBL_AUCTION_DETAIL TAD on TAD.CASE_DETAIL_ID = aude.CASE_DETAIL_ID
						LEFT JOIN TBL_AUCTION_PROPERTY_MAPPING TAPM WITH(NOLOCK) ON TAPM.AUCTION_ID = TAD.AUCTION_ID
						LEFT JOIN TBL_PROPERTY tPR WITH(NOLOCK) ON tPR.PROPERTY_ID = TAPM.PROPERTY_ID
						LEFT JOIN TBL_AUCTION_PROCEEDING_MAPPING APM WITH(NOLOCK) ON APM.AUCTION_ID = TAD.AUCTION_ID
						LEFT JOIN TBL_PROCEEDING CE WITH(NOLOCK) &#160;ON CE.PROCEEDING_ID = APM.PROCEEDING_ID
						LEFT JOIN TBL_PROPERTY_PARTY_MAPPING PPM WITH(NOLOCK) ON PPM.PROPERTY_ID = tPR.PROPERTY_ID
						LEFT JOIN TBL_PARTY PA WITH(NOLOCK) ON PA.PARTY_ID = PPM.PARTY_ID
						LEFT JOIN TBL_CASE_DETAIL_PARTY_MAPPING CDPM WITH(NOLOCK) ON CDPM.CASE_DETAIL_ID = aude.CASE_DETAIL_ID
						LEFT JOIN TBL_CASE_DETAIL_PARTY_COUNSEL_REPRESENT CDPCR WITH(NOLOCK) ON CDPCR.CASE_DETAIL_PARTY_DETAIL_ID = CDPM.CASE_DETAIL_ID
						LEFT JOIN COMMON.dbo.TBL_COURT &#160;C WITH(NOLOCK) ON C.COURT_ID = aude.COURT_ID
						LEFT JOIN COMMON.dbo.VIEW_SELT_COURT_LOCATION vSCL ON vSCL.COURT_LOCATION_ID = C.COURT_LOCATION_ID
						WHERE &#160;CULTURE_CODE = &#039;ms-MY&#039;					
						) tPR
						FOR XML PATH(&#039;Foreclosure&#039;),type).value(&#039;.&#039;,&#039;varchar(max)&#039;)) AS a(list);
I can get the result like one row like string but I need to display like xml file but need one row.. how I can get it??]]></description>
			<content:encoded><![CDATA[<p>select a.list from (<br />
select(<br />
SELECT<br />
PROPERTY_ID<br />
AUCTION_ID,<br />
CASE_NO AS CaseNumber,<br />
PROCEEDING_ID ,<br />
FC_STATE_CD, &nbsp;<br />
LAND_TITLE,<br />
RESTRICTION_IN_INTEREST,<br />
RESERVED_PRICE, 1 as PropertyInAuction, COURT_LOCATION_NAME, PROCEEDING_DATE AS AuctionDate, 1 AS NumberOfAuction, MINIMUM_BID AS MinimumBid, DEPOSIT_PERCENTAGE AS DepositPercentage,<br />
PANEL_BANK_PROCESSING_FEE AS PanelBankProcessingFee, STAMP_DUTY AS StampDuty, PAYMENT_TERMS AS PaymentTerm, COUNSEL_ID AS CounsellorId, ATTACHMENT_PATH AS DocumentId, 0 AS STATUS, GETDATE() AS CreatedDate,<br />
1 AS CreatedBy, GETDATE() AS ModifiedDate, 1 AS ModifiedBy,<br />
		(<br />
					SELECT DISTINCT<br />
					PR.PROPERTY_ID,<br />
					AD.AUCTION_ID,<br />
					CD.CASE_NO AS [Property/CaseNumber],<br />
					CE.PROCEEDING_ID AS [Property/ProceedingId],<br />
					PR.PROPERTY_ID AS [Property/PropertyId],<br />
					PR.TITLE_NUMBER AS [Property/TitleNumber],<br />
					PR.BANK_NAME AS [Property/BankName],<br />
					PR.MUKIM AS [Property/Mukim],<br />
					PR.DISTRICT AS [Property/District],<br />
					PR.LOT_NUMBER AS [Property/LotNumber],<br />
					PR.PARCEL_NUMBER AS [Property/ParcelNumber],<br />
					PR.STORY_NUMBER AS [Property/StoreyNumber],<br />
					PR.BUILDING_NUMBER AS [Property/BuildingNumber],<br />
					PR.EXPRESS_CONDITION AS [Property/ExpressCondition],<br />
					PR.TENURE AS [Property/Tenure],<br />
					PR.BUILT_UP AS [Property/BuiltUp],<br />
					PR.LAND_AREA AS [Property/LandArea],<br />
					PR.REGISTER_OWNER AS [Property/RegisterOwner],<br />
					PR.FACILITIES AS [Property/Facilities],<br />
					PR.EMCUMBRANCES AS [Property/Emcumbrances],<br />
					PR.PROPERTY_TYPE AS [Property/PropertyType],<br />
					PR.UNIT_NUMBER AS [Property/UnitNumber],<br />
					PR.FLOOR AS [Property/Floor],<br />
					PR.BUILDING_NAME AS [Property/BuildingName],<br />
					PR.STREET AS [Property/Street],<br />
					PR.SECTION AS [Property/Section],<br />
					PR.POST_CD AS [Property/Postcode],<br />
					PR.CITY AS [Property/City],<br />
					PR.POSTAL_STATE_CD AS [Property/PostalStatecode],<br />
					GETDATE() AS [Property/CreatedDate],<br />
					1 AS [Property/CreatedBy],<br />
					GETDATE() AS [Property/ModifiedDate],<br />
					1 AS [Property/ModifiedBy]<br />
					from TBL_CASE_DETAIL cd WITH(NOLOCK)<br />
					inner join TBL_AUCTION_DETAIL AD on AD.CASE_DETAIL_ID = cd.CASE_DETAIL_ID<br />
					LEFT JOIN TBL_AUCTION_PROPERTY_MAPPING TAPM WITH(NOLOCK) ON TAPM.AUCTION_ID = AD.AUCTION_ID<br />
					LEFT JOIN TBL_PROPERTY PR WITH(NOLOCK) ON PR.PROPERTY_ID = TAPM.PROPERTY_ID<br />
					LEFT JOIN TBL_AUCTION_PROCEEDING_MAPPING APM WITH(NOLOCK) ON APM.AUCTION_ID = AD.AUCTION_ID<br />
					LEFT JOIN TBL_PROCEEDING CE WITH(NOLOCK) &nbsp;ON CE.PROCEEDING_ID = APM.PROCEEDING_ID<br />
					LEFT JOIN TBL_PROPERTY_PARTY_MAPPING PPM WITH(NOLOCK) ON PPM.PROPERTY_ID = PR.PROPERTY_ID<br />
					LEFT JOIN TBL_PARTY PA WITH(NOLOCK) ON PA.PARTY_ID = PPM.PARTY_ID<br />
					LEFT JOIN TBL_CASE_DETAIL_PARTY_MAPPING CDPM WITH(NOLOCK) ON CDPM.CASE_DETAIL_ID = CD.CASE_DETAIL_ID<br />
					LEFT JOIN TBL_CASE_DETAIL_PARTY_COUNSEL_REPRESENT CDPCR WITH(NOLOCK) ON CDPCR.CASE_DETAIL_PARTY_DETAIL_ID = CDPM.CASE_DETAIL_ID<br />
					LEFT JOIN COMMON.dbo.TBL_COURT &nbsp;C WITH(NOLOCK) ON C.COURT_ID = CD.COURT_ID<br />
					LEFT JOIN COMMON.dbo.VIEW_SELT_COURT_LOCATION vSCL ON vSCL.COURT_LOCATION_ID = C.COURT_LOCATION_ID<br />
					WHERE &nbsp;tPR.PROPERTY_ID = PR.PROPERTY_ID AND CULTURE_CODE = &#8216;ms-MY&#8217;<br />
					FOR XML PATH(&#8221;), TYPE<br />
			)<br />
			from<br />
						(SELECT DISTINCT tPR.PROPERTY_ID, TAD.AUCTION_ID, aude.CASE_NO, CE.PROCEEDING_ID ,tPR.FC_STATE_CD, &nbsp;tPR.LAND_TITLE, tPR.RESTRICTION_IN_INTEREST,<br />
						TAD.RESERVED_PRICE, 1 as PropertyInAuction,vSCL.COURT_LOCATION_NAME, CE.PROCEEDING_DATE , 1 AS NumberOfAuction, TAD.MINIMUM_BID, TAD.DEPOSIT_PERCENTAGE,<br />
						PANEL_BANK_PROCESSING_FEE, STAMP_DUTY, PAYMENT_TERMS, COUNSEL_ID, ATTACHMENT_PATH, 0 AS STATUS, GETDATE() AS CreatedDate,<br />
						1 AS CreatedBy, GETDATE() AS ModifiedDate, 1 AS ModifiedBy &nbsp;from TBL_CASE_DETAIL aude<br />
						inner join TBL_AUCTION_DETAIL TAD on TAD.CASE_DETAIL_ID = aude.CASE_DETAIL_ID<br />
						LEFT JOIN TBL_AUCTION_PROPERTY_MAPPING TAPM WITH(NOLOCK) ON TAPM.AUCTION_ID = TAD.AUCTION_ID<br />
						LEFT JOIN TBL_PROPERTY tPR WITH(NOLOCK) ON tPR.PROPERTY_ID = TAPM.PROPERTY_ID<br />
						LEFT JOIN TBL_AUCTION_PROCEEDING_MAPPING APM WITH(NOLOCK) ON APM.AUCTION_ID = TAD.AUCTION_ID<br />
						LEFT JOIN TBL_PROCEEDING CE WITH(NOLOCK) &nbsp;ON CE.PROCEEDING_ID = APM.PROCEEDING_ID<br />
						LEFT JOIN TBL_PROPERTY_PARTY_MAPPING PPM WITH(NOLOCK) ON PPM.PROPERTY_ID = tPR.PROPERTY_ID<br />
						LEFT JOIN TBL_PARTY PA WITH(NOLOCK) ON PA.PARTY_ID = PPM.PARTY_ID<br />
						LEFT JOIN TBL_CASE_DETAIL_PARTY_MAPPING CDPM WITH(NOLOCK) ON CDPM.CASE_DETAIL_ID = aude.CASE_DETAIL_ID<br />
						LEFT JOIN TBL_CASE_DETAIL_PARTY_COUNSEL_REPRESENT CDPCR WITH(NOLOCK) ON CDPCR.CASE_DETAIL_PARTY_DETAIL_ID = CDPM.CASE_DETAIL_ID<br />
						LEFT JOIN COMMON.dbo.TBL_COURT &nbsp;C WITH(NOLOCK) ON C.COURT_ID = aude.COURT_ID<br />
						LEFT JOIN COMMON.dbo.VIEW_SELT_COURT_LOCATION vSCL ON vSCL.COURT_LOCATION_ID = C.COURT_LOCATION_ID<br />
						WHERE &nbsp;CULTURE_CODE = &#8216;ms-MY&#8217;<br />
						) tPR<br />
						FOR XML PATH(&#8216;Foreclosure&#8217;),type).value(&#8216;.&#8217;,&#8217;varchar(max)&#8217;)) AS a(list);<br />
I can get the result like one row like string but I need to display like xml file but need one row.. how I can get it??</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: sanket		</title>
		<link>https://lobsterpot.com.au/blog/2010/04/15/handling-special-characters-with-for-xml-path/#comment-1360</link>

		<dc:creator><![CDATA[sanket]]></dc:creator>
		<pubDate>Wed, 10 Aug 2016 11:42:30 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.lobsterpot.com.au/?p=2699#comment-1360</guid>

					<description><![CDATA[Thanks Brad. it helped me lot.]]></description>
			<content:encoded><![CDATA[<p>Thanks Brad. it helped me lot.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: mohana		</title>
		<link>https://lobsterpot.com.au/blog/2010/04/15/handling-special-characters-with-for-xml-path/#comment-1359</link>

		<dc:creator><![CDATA[mohana]]></dc:creator>
		<pubDate>Wed, 03 Aug 2016 15:17:45 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.lobsterpot.com.au/?p=2699#comment-1359</guid>

					<description><![CDATA[hi,
FOR XML PATH(&#039;&#039;), TYPE).value(&#039;.&#039;, &#039;NVARCHAR(MAX)&#039;) ,1, 1, &#039;&#039;) as Director_Name
i am getting 
Msg 6841, Level 16, State 1, Line 1
FOR XML could not serialize the data for node &#039;NoName&#039; because it contains a character (0x001A) which is not allowed in XML. To retrieve this data using FOR XML, convert it to binary, varbinary or image data type and use the BINARY BASE64 directive.
please help me.]]></description>
			<content:encoded><![CDATA[<p>hi,<br />
FOR XML PATH(&#8221;), TYPE).value(&#8216;.&#8217;, &#8216;NVARCHAR(MAX)&#8217;) ,1, 1, &#8221;) as Director_Name<br />
i am getting<br />
Msg 6841, Level 16, State 1, Line 1<br />
FOR XML could not serialize the data for node &#8216;NoName&#8217; because it contains a character (0x001A) which is not allowed in XML. To retrieve this data using FOR XML, convert it to binary, varbinary or image data type and use the BINARY BASE64 directive.<br />
please help me.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Petko Dinev		</title>
		<link>https://lobsterpot.com.au/blog/2010/04/15/handling-special-characters-with-for-xml-path/#comment-1358</link>

		<dc:creator><![CDATA[Petko Dinev]]></dc:creator>
		<pubDate>Thu, 28 Jul 2016 16:07:59 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.lobsterpot.com.au/?p=2699#comment-1358</guid>

					<description><![CDATA[Thank you for sharing Rob.
All the best!]]></description>
			<content:encoded><![CDATA[<p>Thank you for sharing Rob.<br />
All the best!</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Rose		</title>
		<link>https://lobsterpot.com.au/blog/2010/04/15/handling-special-characters-with-for-xml-path/#comment-1357</link>

		<dc:creator><![CDATA[Rose]]></dc:creator>
		<pubDate>Fri, 15 Jul 2016 09:29:56 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.lobsterpot.com.au/?p=2699#comment-1357</guid>

					<description><![CDATA[Thanks Rob - Great post - I&#039;ve been looking for a solution to this for awhile.i really appreciate ,i just wanted to tell you you use cool trick and That&#039;s the best CSV that I&#039;ve seen.. Still]]></description>
			<content:encoded><![CDATA[<p>Thanks Rob &#8211; Great post &#8211; I&#8217;ve been looking for a solution to this for awhile.i really appreciate ,i just wanted to tell you you use cool trick and That&#8217;s the best CSV that I&#8217;ve seen.. Still</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Madhuri		</title>
		<link>https://lobsterpot.com.au/blog/2010/04/15/handling-special-characters-with-for-xml-path/#comment-1356</link>

		<dc:creator><![CDATA[Madhuri]]></dc:creator>
		<pubDate>Tue, 12 Apr 2016 13:21:18 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.lobsterpot.com.au/?p=2699#comment-1356</guid>

					<description><![CDATA[Really, it&#039;s cool trick. it helped me a lot.]]></description>
			<content:encoded><![CDATA[<p>Really, it&#8217;s cool trick. it helped me a lot.</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
