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)
 need help on SP using XML related functions

Author  Topic 

shefu
Starting Member

5 Posts

Posted - 2007-04-20 : 01:52:27
Hi all,

I came across the below SQLServer stored procedure, I understand that it manipulates some XML data, but am not sure what it does.. Could any one pls explain me on the below procedure,

Also, i do not see 'values' clause in the insert statement in the below procedure, is it valid to use in this way? (as per the syntax, 'values' clause is NOT optional)


CREATE PROCEDURE [dbo].[OM_addObjData]
@xml_Doc_sample varchar(max),
@objID int

AS
BEGIN

--set @xml_Doc_sample = '<?xml version="1.0" encoding="utf-8"?><ArrayOfEXEData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><EXEData><EXEName>exeName</EXEName><EXECommand>exeCommand</EXECommand></EXEData></ArrayOfEXEData>'

declare @docIdx int
EXECUTE sp_xml_preparedocument @docIdx OUTPUT, @xml_Doc_sample


insert into OM_EXE
select @objID, exeName, exeCommand, IdEXE, EXE
From OPENXML(@docIdx, N'/ArrayOfEXEData/EXEData', 2) With OM_EXE


EXECUTE sp_xml_removedocument @docIdx

END

Thanks in advance,
Sn

Today will be yesterday tomorrow, Do it now..

Vinnie881
Master Smack Fu Yak Hacker

1231 Posts

Posted - 2007-04-20 : 03:00:47
This should explain it fairly well.

http://www.informit.com/articles/article.asp?p=26499&rl=1
Go to Top of Page
   

- Advertisement -