Title: [OT] XPath in MS SQL
OK I got something, but surely that can't be the way to do it?
 
DECLARE @xmlEmployee VARCHAR(8000)
DECLARE @handleToDocument INT
DECLARE @firstName VARCHAR(20), @lastName VARCHAR(20)
 
SET @xmlEmployee = '<search firstName="Taco" lastName="Fleur"/>'
 

 EXEC sp_xml_preparedocument @handleToDocument OUTPUT, @xmlEmployee
 
 SELECT   @firstName = firstName,
   @lastName = lastName
 FROM  OPENXML(@handleToDocument, '/search')
 WITH   (firstName VARCHAR(20), lastName VARCHAR(20))
 
SELECT @firstName
SELECT @lastName
-----Original Message-----
From: Taco Fleur
Sent: Tuesday, 8 June 2004 1:07 PM
To: CFAussie Mailing List
Subject: [cfaussie] [OT] XPath in MS SQL

I pass an XML document to MS SQL, I then parse it with sp_xml_preparedocument, I now have a handle to the document, is it possible to use XPath or something to do something like

SELECT * FROM tbl WHERE firstname = @search/firstname

I have been able to work with this xml document and insert it into the db as
INSERT INTO
SELECT *
FROM OPENXML(......

Which works like a dream, but what about some fancier stuff like the above?????

Anyone, since you are all so anxious to make some noise?...


---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED] Aussie Macromedia Developers: http://lists.daemon.com.au/
Register now for the 3rd National Conference on Tourism Futures, being held in Townsville, North Queensland 4-7 August - www.tq.com.au/tfconf
---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED] Aussie Macromedia Developers: http://lists.daemon.com.au/
Register now for the 3rd National Conference on Tourism Futures, being held in Townsville, North Queensland 4-7 August - www.tq.com.au/tfconf



Reply via email to