Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
ftsoft
Starting Member
22 Posts |
Posted - 2010-07-15 : 19:53:38
|
HelloI have a SP which builds an XML string below:It creates the XML string <E18><E18_03>0</E18_03><E18_08>4390</E18_08></E18><E18><E18_03>0</E18_03><E18_08>4390</E18_08></E18><E18/><E18/>The datbase table looks like:pk_E18 fk_E01 E18_03 E18082036 1016 0 43902037 1016 0 4390I'm not sure why the <E18/>'s appear at the end, but I would like to get rid of them.Thanks for your help.ALTER PROCEDURE [dbo].[RunXMLE18] ( @RunID varchar(10) ) AS /* SET NOCOUNT ON */ SELECT 1 as Tag, NULL as Parent, E18_03 as [E18!1!E18_03!Element], E18_08 as [E18!1!E18_08!Element] FROM E01 INNER JOIN E18 ON E01.pk_E01 = E18.fk_E01 WHERE E01.E01_01 = @RunID AND E18_03 IS NOT NULL UNION ALLSELECT 1 as tag, NULL as parent, NULL, NULL FROM E01 INNER JOIN E18 ON E01.pk_E01 = E18.fk_E01 WHERE E01.E01_01 = @RunID AND E18_03 IS NOT NULL FOR XML EXPLICIT RETURN Frank |
|
Sachin.Nand
2937 Posts |
Posted - 2010-07-16 : 00:56:21
|
There are no root nodes for your XML.Limitations live only in our minds. But if we use our imaginations, our possibilities become limitless. PBUH |
 |
|
ftsoft
Starting Member
22 Posts |
Posted - 2010-07-16 : 07:44:38
|
I'm not sure what you mean? This is just a fragment of the entire xml which is created by several SP's. I have to admit that the FOR XML Explicit syntax is not my strong point.Frank |
 |
|
Sachin.Nand
2937 Posts |
Posted - 2010-07-16 : 08:49:51
|
You need to post the entire XML.Limitations live only in our minds. But if we use our imaginations, our possibilities become limitless. PBUH |
 |
|
yosiasz
Master Smack Fu Yak Hacker
1635 Posts |
|
|
|
|