I want to pass xml document to sql server stored procedure such as this:
CREATE PROCEDURE BookDetails_Insert (@xml xml)
I want compare some
As stated in http://support.microsoft.com/kb/555266, you need to pass xml data as NText.
You can query an XML variable as follows:
DECLARE @PeopleXml XML
SET @PeopleXml = '
James
28
Jane
24
'
-- put [1] at the end to ensure the path expression returns a singleton.
SELECT p.c.value('Person[1]/Name[1]', 'varchar(50)')
FROM @PeopleXml.nodes('People') p(c) -- table and column aliases