Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Multiple Insert/update rows using xml

Author  Topic 

om09
Starting Member

2 Posts

Posted - 2009-03-24 : 10:02:29
Hi all,

I want to insert multiple row from xml file to table in database..
i am try this code to insert..

ALTER PROCEDURE sp_InsertByXML ( @strXML VARCHAR(4000) )

AS

BEGIN

DECLARE @intDocHandle int



--Create an internal representation of the XML document.

EXEC sp_xml_preparedocument @intDocHandle OUTPUT, @strXML



INSERT INTO Person ( PersonId, PersonName )

SELECT * FROM OPENXML(@intDocHandle,

'/PersonData/Person', 2)

WITH

( PersonId INT,

PersonName VARCHAR(100)

)



-- Remove the internal representation.

EXEC sp_xml_removedocument @intDocHandle



END


please any one help me to resolve this issue.

Regards,
Om


om

yosiasz
Master Smack Fu Yak Hacker

1635 Posts

Posted - 2009-03-24 : 16:13:17
so what seems to be the problem? do you haev an xml string?
Go to Top of Page

om09
Starting Member

2 Posts

Posted - 2009-03-25 : 02:42:35
ya. i am using an xml file.then i want all the data from xml to insert at in single click of button to database table.

Regards,
Om

om
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-03-25 : 14:24:33
how will be xml structure?
Go to Top of Page
   

- Advertisement -