Почему мешает xmlns в OPENXML

student-uni
Дата: 14.01.2009 11:41:47
Без xmlns этот код срабатывает и возвращает значения "Source=MyServer;Initial Catalog=myBase"

SET @xml = '<Report>
				<DataSources>
					<ConnectionProperties><ConnectString>Data Source=MyServer;Initial Catalog=myBase</ConnectString>
					</ConnectionProperties>
				</DataSources>
			</Report>'

SELECT
ID.value('.','NVARCHAR(100)') AS Sehr
FROM @xml.nodes('/Report/DataSources/ConnectionProperties/ConnectString') as ParamValues(ID)

но с xmlns - не возвращает значения.

SET @xml = '<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
				<DataSources>
					<ConnectionProperties><ConnectString>Data Source=MyServer;Initial Catalog=myBase</ConnectString>
					</ConnectionProperties>
				</DataSources>
			</Report>'

SELECT
ID.value('.','NVARCHAR(100)') AS Sehr
FROM @xml.nodes('/Report/DataSources/ConnectionProperties/ConnectString') as ParamValues(ID)



Почему ?



Спасибо
student-uni
Дата: 14.01.2009 14:33:59
	EXEC sp_xml_preparedocument @idoc OUT, @xml, '<root xmlns:default="http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition"/>'
	print CAST(@idoc as varchar(10))
	SELECT * FROM 
OPENXML(@idoc,'//default:ConnectionProperties',2) 
WITH ([default:ConnectString] VARCHAR(50), [default:DataProvider] VARCHAR(50))
	EXEC sp_xml_removedocument @idoc




автор
http://sql.ru/forum/actualthread.aspx?tid=95420&hl=xmlns