Solved

problem in executing "sp_xml_preparedocument" stored procedure

Posted on 2006-10-24
3
675 Views
Last Modified: 2008-02-26
Hello,

I am executing this below code in sql queryanalyzer .It returns the null value.

Here is my code

 exec sp_xml_preparedocument @hDoc OUTPUT,'<Shops><Shop><col1>01000200</col1><col2>49.035792</col2><col3>-122.338480</col3><col4>ADDRESS</col4></Shop></Shops>'
Select col1,col2,col3,col4
 FROM OPENXML(@hDoc, 'Shops/shop')  
 WITH (col1 varchar(10),col2 varchar(50),col3 varchar(50),col4 varchar(50))

output
-----------------
col1   col2  col3  col4
---------------------------
null  null    null    null

But it should return the value of col1,col2,col3,col4.

Could anyone help me for this.

0
Comment
Question by:r_pat72
[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
3 Comments
 
LVL 75

Accepted Solution

by:
Anthony Perkins earned 500 total points
ID: 17800798
Try it this way:

Select      col1,
            col2,
            col3,
            col4
FROM      OPENXML(@hDoc, 'Shops/Shop') WITH (
            col1 varchar(10) 'col1',
            col2 varchar(50) 'col2',
            col3 varchar(50) 'col3',
            col4 varchar(50)'col4')
0

Featured Post

Webinar: MariaDB® Server 10.2: The Complete Guide

Join Percona’s Chief Evangelist, Colin Charles as he presents MariaDB Server 10.2: The Complete Guide on Tuesday, June 27, 2017 at 7:00 am PDT / 10:00 am EDT (UTC-7).

Question has a verified solution.

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

When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

688 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