Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using text/ntext field in a stored procedure

Status
Not open for further replies.

spaliwal

Programmer
Dec 28, 2001
31
0
0
IN
Hi,

I have to retrive text/ntext field in a stored procedure , it contains XML patterns.I have to parse that xml in a tabular form. But problem is it is not possible to retrive text/ntext field in a local variable.Can anybody can suggest how to retrive text/ntext datatype field in a local variable. I am using sql server 2000.This is the code stored procedure.By this way imcomplete xml is coming out from the table.

Thanks,

Shailesh

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO



ALTER PROCEDURE ParseDefaultCarePlanDetailXML(@x_DefaultCarePlanDetailOID varchar(32)) AS

declare @idoc int
declare @idoc1 int

declare @doc varchar(4000)


SELECT @doc = convert(varchar,DefaultCarePlanDetail.DetailXML)
FROM DefaultCarePlanDetail
WHERE OID = @x_DefaultCarePlanDetailOID


--Create an internal representation of the XML document.
exec sp_xml_preparedocument @idoc OUTPUT, @doc
-- SELECT stmt using OPENXML rowset provider

SELECT *
FROM OPENXML (@idoc, '/defaultCarePlan/drugCondition/problem/goal/intervention',1)
WITH (
DrugConditionTitle varchar(255) '../../../drugConditionTitle',
ProblemTitle varchar(255) '../../problemTitle',
GoalTitle varchar(255) '../goalTitle',
MonitorTitle varchar(255) '../monitor/monitorTitle',
InterventionTitle varchar(255) 'interventionTitle')
ORDER BY DrugConditionTitle, ProblemTitle, GoalTitle


EXEC sp_xml_removedocument @idoc




GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top