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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Problem with .Nodes and XML schema

Author  Topic 

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-12-21 : 09:00:33
DECLARE @xml

SELECT ...
FROM @xml.nodes(..) t(v)

this above works. But when typing the schema to the declaration, same code fails!

DECLARE @xml(somexmlschema)

SELECT ...
FROM @xml.nodes(..) t(v)

the code fails. where do I have to put the "somexmlschema" declaration in the .Nodes part to make it work?



E 12°55'05.25"
N 56°04'39.16"

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-12-21 : 09:15:22
Do you get any error?

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-12-21 : 13:28:32
Yes. "Cannot find node xxx...".



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-12-21 : 13:29:19
And it is not during runtime, but as early as compile time!



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-12-21 : 13:42:25
This seems to fix the compile error.

DECLARE @xml(somexmlschema)

;WITH XMLNAMESPACES (DEFAULT 'same namespace url as defined in the schema')
SELECT ...
FROM @xml.nodes(..) t(v)

Thank you for your attention.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page
   

- Advertisement -