Solved

Stored procedure  - OPENXML

Posted on 2003-12-04
1
558 Views
Last Modified: 2010-08-05
Hi,

how can I select an attribute using OPENXML and put it into the value of a stored procedure variable?

cheers,

henrik
0
Comment
Question by:henrikatwork
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 5

Accepted Solution

by:
xnmb earned 500 total points
ID: 9887829
you can do so just like any inline variable assignment in selecct queries. Sample:

declare       @ID int,
      @DOc int,
      @XML varchar(1024)

                 set @XML='<ROOT>
                  <Node>
                        <ID>1</ID>
                  </Node>
            </ROOT>'

      exec sp_xml_preparedocument @Doc output, @XML

      select @ID=ID
      from openxml(@Doc,'/ROOT/Node',2)
      with (ID int)

      select @ID as ID

      exec sp_xml_removedocument @Doc
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question