how to fetch data from XML and update database table.
Posted
by
ppp
on Stack Overflow
See other posts from Stack Overflow
or by ppp
Published on 2011-02-15T07:24:47Z
Indexed on
2011/02/15
7:25 UTC
Read the original article
Hit count: 130
I am passing serialized collection(XML) to stored procedure. My XML structure is-
<ArrayofDepartmentEntity>
<Department>
<id>1004</id>
<budget>2500.oo</budget>
</Department>
<Department>
<id>1080</id>
<budget>3500.oo</budget>
</Department>
<Department>
<id>1029</id>
<budget>4500.00</budget>
</Department>
</ArrayofDepartmentEntity>
How can I UPDATE corresponding budget column where department IDs are in above XML?? can any body write down the sql syntax.
my SP syntax-
ALTER PROCEDURE [dbo].[usp_SaveDepartentBudget] (
@departmentBudgetXML ntext = NULL
)
AS
BEGIN
DECLARE @ptrHandle int
EXEC sp_xml_preparedocument @ptrHandle OUTPUT, @departmentBudgetXML
....Here I want to update Budget foreach departmentID in @departmentBudgetXML
© Stack Overflow or respective owner