Wrox Programmer Forums
|
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
 
Old December 17th, 2003, 12:29 AM
Registered User
 
Join Date: Dec 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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

 
Old December 17th, 2003, 04:47 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 625
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to jemacc
Default

try looking up information on DTS. I has an XML Task.

 
Old December 17th, 2003, 06:46 PM
Registered User
 
Join Date: Dec 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.
 
Old December 18th, 2003, 05:43 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

I think you'll find a method here:
http://www.sqlxml.org/faqs.aspx?faq=29
 
Old December 18th, 2003, 07:20 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 336
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to alyeng2000
Default

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
 
Old December 18th, 2003, 08:46 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

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.
 
Old December 18th, 2003, 10:46 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

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)
 
Old December 21st, 2003, 04:54 PM
Registered User
 
Join Date: Dec 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

 
Old December 21st, 2003, 05:42 PM
Registered User
 
Join Date: Dec 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.






Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I export an access db table to xml? solos VB How-To 4 April 3rd, 2007 11:56 PM
Export SQL To XML shillr SQL Server 2000 0 August 1st, 2006 10:14 AM
Trigger/XML Export Neal Access VBA 2 March 30th, 2006 11:43 PM
export crystal report with oracle db in VB g-mey Pro VB Databases 0 February 8th, 2005 12:28 AM
Export SQL db to MSDE planeswalk SQL Server 2000 1 October 8th, 2004 03:44 PM





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