Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Search | Today's Posts | Mark Forums Read
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 5th, 2006, 05:56 AM
Registered User
 
Join Date: Nov 2004
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default OPENXML

Can anyone help me?.I am running this script but it does not give any result.

declare @doc varchar(8000)
select @doc ='
<?xml version="1.0" encoding="utf-8" ?>
<UTSv_ProviderAvailRS xmlns="http://www.eviivo.com/UTSv/2004/01/01" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eviivo.com/UTSv/2004/01/01/UTSv_ProviderAvailRS.xsd" TimeStamp="2004-08-17T09:30:47-05:00" Target="Production">
<ProductProviders>
  <ProductProvider ID="DMS_PROV_ID_1" SpecialOffer="true" />
  <ProductProvider ID="DMS_PROV_ID_2" Package="true" />
  </ProductProviders>
  </UTSv_ProviderAvailRS>'
--Create an internal representation of the XML document.
exec sp_xml_preparedocument @idoc OUTPUT, @doc
-- SELECT stmt using OPENXML rowset provider
SELECT *
FROM OPENXML (@idoc, '/UTSv_ProviderAvailRS/ProductProviders/ProductProvider',2)
         WITH (ID varchar(30) '@ID'
          ,SpecialOffer varchar(30) '@SpecialOffer'
              ,Package varchar(30) '@Package'
             )

Reply With Quote
  #2 (permalink)  
Old May 5th, 2006, 06:13 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

I suggest you read up on namespaces:

http://www.dpawson.co.uk/xsl/sect2/N5536.html

especially numbers 13 and 23.

Then take a look at this:

http://www.sqlxml.org/faqs.aspx?faq=66

it shows how to declare a namespace prefix mapping with OPENXML.



--

Joe (Microsoft MVP - XML)
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off




All times are GMT -4. The time now is 07:40 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.