?
Solved

problem in executing "sp_xml_preparedocument" stored procedure

Posted on 2006-10-24
3
Medium Priority
?
687 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 2000 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

Get proactive database performance tuning online

At Percona’s web store you can order full Percona Database Performance Audit in minutes. Find out the health of your database, and how to improve it. Pay online with a credit card. Improve your database performance now!

Question has a verified solution.

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

Recently I was talking with Tim Sharp, one of my colleagues from our Technical Account Manager team about MongoDB’s scalability. While doing some quick training with some of the Percona team, Tim brought something to my attention...
In this blog post, we’ll look at how ClickHouse performs in a general analytical workload using the star schema benchmark test.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

752 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