Querying XML Col where a namespace is defined, and elemets have namespace prefix, using WITH XMLNAMESPACES. This works fine, but if a row's xml namespace def doesn't match the WITH XMLNAMESPACES def for that namespace, the query fails. Can I define the WITH XMLNAMESPACES to use a wildcard so all rows will work regardless of any slight row-by-row variation?
For ex, these two rows match up to the last part. If I could define the WITH XMLNAMESPACES like so ('http://schemas.microsoft.com/office/infopath/2003/myXSD/
* ' AS my), both rows would respond.
- Row 1 <my:myFields xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2007-08-29T18:23:34 "
- Row 2 <my:myFields xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2009-07-13T20:25:06 "
Also, is there a performance hit for using wildcards in XQuery select statements? For ex:
SELECT top 100 tp_LeafName
, xmlForm.exist('/*:myFields/*:FileAs') as chk -- example of wildcards as the ns prefix
,xmlForm.value('data((//*:myFields/*:FileAs)[1])', 'nvarchar(255)') AS FileAs
FROM [Enterprise].[InfoPath].[Forms]
CROSS APPLY xmlForm.nodes ('//*:myFields/*:Contact') R(ClientMatter)
/bac