
Signature
Dino Chiesa
Microsoft Developer Division
d i n o c h @ o n l i n e . m i c r o s o f t . c o m
> I have two simple tables in my DB: "person" and "phone". Person has 3
> fields: id, fistname and lastname. Phone has two fields: id and phonenumber.
[quoted text clipped - 15 lines]
>
> Shawn
I'm using a Sybase DB. I know Sybase can produce XML, but I was told I had
to do it through code. Any ideas?
Shawn
Are you using SQL Server? if so, there is a FOR XML syntax that can do
this.
http://www.microsoft.com/mspress/books/sampchap/5178c.asp
Other databases have similar support for producing XML from queries, but it
varies.
-Dino

Signature
Dino Chiesa
Microsoft Developer Division
d i n o c h @ o n l i n e . m i c r o s o f t . c o m
> I have two simple tables in my DB: "person" and "phone". Person has 3
> fields: id, fistname and lastname. Phone has two fields: id and
phonenumber.
> Each person can have many phonenumbers. I wish to create an xml file out
of
> the two tables. Something like this:
> <user>
[quoted text clipped - 12 lines]
>
> Shawn
Robert Rossney - 28 Oct 2003 17:01 GMT
: I'm using a Sybase DB. I know Sybase can produce XML, but I was told I had
: to do it through code. Any ideas?
If you're using ADO to access the database, you can use the Recordset
object's Save method to persist a recordset as an XML document.
Bob Rossney
rbr@well.com
Dino Chiesa [Microsoft] - 28 Oct 2003 17:23 GMT
Also, if you are using ADO.NET, you can also use the WriteXml method on the
DataSet instance. The issue with either of these approaches (with ADO and
with ADO.NET) is that you don't have a great deal of control over the
"shape" of the XML. You get the recordset schema, or the dataset schema,
respectively. With the "FOR XML" support in sQL Server, you, the
programmer, have control over the XML Schema - the shape of the output XML.
The same is true for other databases' special support for XML, but I am not
an expert in Sybase or IBM or Oracle, so i cannot comment on particulars. I
believe they all do something similar.
-Dino
> : I'm using a Sybase DB. I know Sybase can produce XML, but I was told I
> had
[quoted text clipped - 5 lines]
> Bob Rossney
> rbr@well.com