 |
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|

December 17th, 2003, 12:29 AM
|
Registered User
|
|
Join Date: Dec 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Export to XML from DB
Hi,
I am looking for a way to export from a couple of databases (SQL Server 2000 and Oracle 9i) to XML. Does anyone have any simple suggestions
Thanks
Hamish
|

December 17th, 2003, 04:47 PM
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 625
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
try looking up information on DTS. I has an XML Task.
|

December 17th, 2003, 06:46 PM
|
Registered User
|
|
Join Date: Dec 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I have seen that it has XML support, but when I tried using the Data export wizard, I could only export to another database or datasource, I did not have an XML option. I was thinking I might have to create a DTS package and use some VBScript to do it. But I have never used DTS packages, so that will be a bit of a learning curve.
I am using SQL Server 2000.
|

December 18th, 2003, 05:43 AM
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
|
|
|

December 18th, 2003, 07:20 AM
|
Friend of Wrox
|
|
Join Date: Oct 2003
Posts: 336
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
for SqlServer
if you only need some queries to be exported to Xml,
you can end your query in QA with "for xml auto" and output the result to a file
Ahmed Ali
Software Developer
|

December 18th, 2003, 08:46 AM
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Quote:
quote:Originally posted by alyeng2000
for SqlServer
if you only need some queries to be exported to Xml,
you can end your query in QA with "for xml auto" and output the result to a file
Ahmed Ali
Software Developer
|
Have you tried this? If you did you'd know that if you try to set up a DTS task where the source is a FOR XML query and the destination is a file then a binary stream gets written to the text file.
|

December 18th, 2003, 10:46 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
|
|
What exactly do you mean? Do you want the schema, tables and columns, stored procs etc., or all the data or both? What is going to use the result? I ask this because it makes a difference to how the original export is formatted.
Joe (MVP - xml)
|

December 21st, 2003, 04:54 PM
|
Registered User
|
|
Join Date: Dec 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks for your replies. I should have been a bit more specific, all I am after is the data from various tables. eg if I have a 'Customers' table with a 'FirstName' field and 'LastName' field, I would want something like:
<customersTable>
<customer>
<firstName>Bob</firstname>
<lastname>Jone</lastname>
</customer>
<customer>
<firstName>James</firstName>
<lastName>Smith</lastName>
</customer>
</customersTable>
This is all I need, for a series of tables, I would want all fields in each table exported. It does not matter if all the tables are in the same file, but I guess it would be easier to deal with if I have each table in a separate file.
Thanks
|

December 21st, 2003, 05:42 PM
|
Registered User
|
|
Join Date: Dec 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I have looked at that link given by pgtips, that is a great page! I implemented one of the suggestions on there, and it does exactly what I wanted.
Excellent. Thanks.
|
|
 |