Parsing XML in SQL2005

DECLARE @docHandle int
DECLARE @xmlDocument nvarchar(max) -- or xml type
SET @xmlDocument = N'
ABC123
ABC1233232
'
EXEC sp_xml_preparedocument @docHandle OUTPUT, @xmlDocument
-- Use OPENXML to provide rowset consisting of customer data.
--INSERT Customers

declare @Test nvarchar(10)
declare @Test2 nvarchar(10)

SELECT @Test=text
FROM OPENXML(@docHandle, N'/Parameters/Parameter[@name=''Test'']/text()')

SELECT @Test2=text
FROM OPENXML(@docHandle, N'/Parameters/Parameter[@name=''Test2'']/text()')

print @Test
print @Test2

-- WITH Customers
-- Use OPENXML to provide rowset consisting of order data.

Comments

Popular posts from this blog

Data Modelling - Understanding Tools and Techniques Involved

WPF Questions

Installing multiple instance of product using wix