Solved

Stored procedure  - OPENXML

Posted on 2003-12-04
1
557 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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
monitoring configuration for SQL server DB 32 45
push and Pull replication 31 46
find SQL job run average duration 24 53
Delete old Sharepoint backups 2 11
Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

735 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