Click here to Skip to main content
15,917,645 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I need some help here! many thanks to anyone that attempts.

One of the args of this procedure (@NextSlot) is an XML datatype. How do I edit/update/add-to its nodes (attributes and elements) before saving it to dbase.

SQL
ALTER PROCEDURE dbo.GetXmlData
(
	@NextSlot XML OUTPUT,
	@RowID BIGINT
)	
AS
	SET NOCOUNT ON 

	DECLARE @TransXEl XML, @XmlHandle INT, @CurrentStatus NVARCHAR(20)

	SET @TransXEl = (SELECT ContextCol FROM XElTab WHERE RowID = @RowID)
	
		EXEC sp_xml_preparedocument @XmlHandle OUTPUT, @TransXEl;

		SET @CurrentStatus =  (SELECT VariationStatus FROM OPENXML (@XmlHandle, '/PayPattern', 2)
		WITH (VariationStatus VARCHAR(20) '@VariationStatus'))

		IF(@CurrentStatus = 'Vacant')
	-- HOW DO I  UPDATE ELEMENT @CurrentStatus IN @NextSlot
		--AS IN @NextSlot.Element('CurrentStatus').Value = Vacant

	-- OR ADD A NEW ATTRIBUTE TO @TransXEl
    		-- AS IN @TransXEl.Add(new XAttribute('NewAttrib', 'NewValue')

	---OR UPDATE USING OPENXML HANDLE
		-- AS IN UPDATE  OPENXML (@XmlHandle, '/PayPattern', 2) SET 
--'@VariationStatus' = 'ALLOCATED')


believe it or not, too much is at stake for this and many hands are waiting idle for the impasse to be broken! please help!
Posted
Updated 13-Sep-11 4:08am
v4
Comments
GParkings 13-Sep-11 10:10am    
Please don't post questions in all caps, its considered 'shouting' and not very polite. I have re-written your question in appropriate case and also formatted it a little better so as to be more readable

1 solution

Okay folks I found respite @:

http://msdn.microsoft.com/en-us/library/ms190675.aspx;
http://msdn.microsoft.com/en-us/library/ms175466.aspx;

Thank you GParkings - I stand corrected.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900