I want to save an XML file into a text field. That is the easy stuff I think, but I will need to search into this XML file.
I ' m trying to use it in an stored procedured, but I donīt know how to pass the text field as a parameter. And after that It seems not to be possible to use the OPENXML with a text parameter, I need to use the sp_xml_preparedocument but I donīt succes to make it works.
Does anyone know how to do this? I have found something that break the text field into several varchar of 8000 characters, but this implicates to know the exact length of the text file.
Don't know if I'm on the proper road, but I tried creating a procedure like this:
create procedure xml_play @doc text as
DECLARE @idoc int
--Create an internal representation of the XML document.
EXEC sp_xml_preparedocument @idoc OUTPUT, @doc
-- Execute a SELECT statement that uses the OPENXML rowset provider.
FROM OPENXML (@idoc, '/ROOT/m',1)
WITH (n varchar(10),
WHERE n = '2'
I have tried a lot of ways to pass the text.. but if i use something like what you have said, it interprets that the value of the text is just the select statement and said that is not a valid XML head...