August 23, 2009 at 7:34 am
Run the following code in AdventureWorks DB
; WITH XMLNAMESPACES ( 'http://www.w3.org/TR/html4/' AS ns1 )
SELECT ProductModelID as "@ns1:ProductModelID",
Name as "@ns1:ProductModelName",
(
SELECT ProductID as "@ns1:ProductID",
Name as "@ns1:ProductName"
FROM Production. Product
WHERE Production. Product. ProductModelID =
Production. ProductModel. ProductModelID
FOR XML PATH , type
) as "ns1:ProductNames"
FROM Production. ProductModel
WHERE ProductModelID= 7 or ProductModelID= 9
FOR XML PATH ( 'ProductModelData' ), root ( 'root' )
will generate:
How to get rid of xmlns:ns1 = "http://www.w3.org/TR/html4/ " in
August 24, 2009 at 7:48 am
You can't. It is a bug (of sorts). See the Microsoft Connect entry (265956): https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=265956
Please vote and enter your comments.
August 26, 2009 at 8:23 am
Thanks. Is it any way to workaround?
August 26, 2009 at 9:13 am
califny (8/26/2009)
Thanks. Is it any way to workaround?
None that I've found. We use XML extensively as a transport mechanism (i.e., to eliminate an extensive list of scalar parameters and/or to pass collections) to/from our stored procedures and the .Net business logic layer (BLL). Although the resulting XML is a bit "bloated", it is still valid XML. We have had no problems with either the .Net layer or with SQL Server XQuery.
August 29, 2009 at 5:43 am
Thanks so much, JohnG.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply