473,402 Members | 2,050 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

XML datatype to columned dataset

Greetings!

Give a column of XML datatype containing this:

<Foo>
<Name>Bob</Name>
<Area>Ghana</Area>
<Interest>Polar Hiking</Interest>
</Foo>
How do I write SQL that will produce a data set (DYNAMICALLY)?

Name Area Interest
-----------------------------
Bob Ghana Polar Hiking
The idea is that the name of the elements in my XML are untyped, and may
change. But I'd like a dynamic query to handle this mapping.

Thanks for your time.
Dan.


Jul 18 '07 #1
3 3717
Daniel Bass wrote:
Give a column of XML datatype containing this:

<Foo>
<Name>Bob</Name>
<Area>Ghana</Area>
<Interest>Polar Hiking</Interest>
</Foo>
How do I write SQL that will produce a data set (DYNAMICALLY)?

Name Area Interest
-----------------------------
Bob Ghana Polar Hiking
The idea is that the name of the elements in my XML are untyped, and may
change. But I'd like a dynamic query to handle this mapping.
The DataSet has a ReadXml method, if you simply read in that above XML
using that method then the DataSet instance has one table named Foo with
three columns Name, Area, and Interest.

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Jul 18 '07 #2
Thanks for your reply. I'm looking at the SQL side of things, and would like
this in a stored procedure, not in a .Net app...

Any ideas?
Cheers.
Dan.

"Martin Honnen" <ma*******@yahoo.dewrote in message
news:eF**************@TK2MSFTNGP02.phx.gbl...
Daniel Bass wrote:
>Give a column of XML datatype containing this:

<Foo>
<Name>Bob</Name>
<Area>Ghana</Area>
<Interest>Polar Hiking</Interest>
</Foo>
How do I write SQL that will produce a data set (DYNAMICALLY)?

Name Area Interest
-----------------------------
Bob Ghana Polar Hiking
The idea is that the name of the elements in my XML are untyped, and may
change. But I'd like a dynamic query to handle this mapping.

The DataSet has a ReadXml method, if you simply read in that above XML
using that method then the DataSet instance has one table named Foo with
three columns Name, Area, and Interest.

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/

Aug 3 '07 #3
This is really interesting thins.
However, I don't understand what you Daniel wat to do.
Do you want to create table dynamically using xml you mentioned?
Or, do you just want to insert data from xml to already created table?

If possible, please give me more detail information.
I wanna try this one.

Alex

"Daniel Bass" <da***********@blueCAPSbottle.comFIRSTwrote in message
news:uO**************@TK2MSFTNGP04.phx.gbl...
Thanks for your reply. I'm looking at the SQL side of things, and would
like this in a stored procedure, not in a .Net app...

Any ideas?
Cheers.
Dan.

"Martin Honnen" <ma*******@yahoo.dewrote in message
news:eF**************@TK2MSFTNGP02.phx.gbl...
>Daniel Bass wrote:
>>Give a column of XML datatype containing this:

<Foo>
<Name>Bob</Name>
<Area>Ghana</Area>
<Interest>Polar Hiking</Interest>
</Foo>
How do I write SQL that will produce a data set (DYNAMICALLY)?

Name Area Interest
-----------------------------
Bob Ghana Polar Hiking
The idea is that the name of the elements in my XML are untyped, and may
change. But I'd like a dynamic query to handle this mapping.

The DataSet has a ReadXml method, if you simply read in that above XML
using that method then the DataSet instance has one table named Foo with
three columns Name, Area, and Interest.

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/


Sep 19 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: SoYouKnowBrig | last post by:
Hi All, I am using Microsoft.ApplicationBlocks.Cache.CacheManager to persist a System.Data.Dataset object. This Dataset object has a DataTable that is created from an existing DataTable using...
10
by: andrewcw | last post by:
I read in a earlier post that I can get the column of a grid to sort by datetime if the column type was set as Date I deserialize my XML and one attribute of the XSD has type as dateTime but upon...
2
by: Jim McCarthy | last post by:
Hello I'm having trouble using a datareader to retrieve mssql text datatype fields. I can find examples where images are the data stored in the field but the fields I need to work with have text...
1
by: Geraldine Hobley | last post by:
Hello, I have added a new row to a dataset as follows: MyMasterTable.Columns.Add("Total") Even though I convert it's value to decimal using ctype, it is not displayed using the £ symbol in my...
1
by: Arne | last post by:
How do I pass a dataset to a webservices? I need to submit a shoppingcart from a pocket PC to a webservice. What is the right datatype? II have tried dataset as a datatype, but I can't get it to...
1
by: Meelis Lilbok | last post by:
Hi Still cant resolve problem, how to get datatype and properties for field. If if fill DataSet from SQL Database how can i a) Get DataType for specified field b) Get Allow null (if i read...
7
by: Leon | last post by:
Hi, I'm creating a python script that can take a string and print it to the screen as a simple multi-columned block of mono-spaced, unhyphenated text based on a specified character width and...
0
by: Daniel Bass | last post by:
Greetings! Give a column of XML datatype containing this: <Foo> <Name>Bob</Name> <Area>Ghana</Area> <Interest>Polar Hiking</Interest> </Foo>
0
by: Naveen Kumar Srivastava | last post by:
Hi I face a problem to fill dataset I have a oracle table (oracle10g) in which i define a column having userdefine datatype. When i run the select query on table from oracle interface it show...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.