Database
  Home arrow Database arrow Page 5 - Using Data Transformation Services: Can We...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
DATABASE

Using Data Transformation Services: Can We Transfer XML Data?
By: Jayaram Krishnaswamy
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 10
    2006-01-02

    Table of Contents:
  • Using Data Transformation Services: Can We Transfer XML Data?
  • Implementing DTS Transfer of XML
  • DTS Design Details
  • The ActiveX Script
  • ActiveX Script Based Data transfer implementation

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Using Data Transformation Services: Can We Transfer XML Data? - ActiveX Script Based Data transfer implementation


    (Page 5 of 5 )

    The following link here describes the ActiveXScript based exporting of XML to a file. I did not author this article. I have used the script, and made changes, so that I can look at the same example above -- the tiny little table, and the query. The script is as shown. In the DTS designer, drag and drop an ActiveXScript task and double click to open the scripting interface. Cut and paste this script. If you plan to use this script, make sure that you write out sSQL all in one line.

    '**********************************************************************
    '  Visual Basic ActiveX Script
    '  Please refer to the original author here: http://www.sqlxml.org/
    '  faqs.aspx?faq=10
    '************************************************************************
    Function Main()
    Dim oCmd, sSQL, oDom
    Set oDom = CreateObject("Msxml2.DOMDocument.4.0")
    Set oCmd = CreateObject ("ADODB.Command")
    oCmd.ActiveConnection = "Provider=<b>SQLOLEDB</b>;
    Data Source=(local);Initial & _ Catalog=<b>TestWiz</b>; Integrated Security=SSPI" sSQL = "<ROOT xmlns:sql='urn:schemas-microsoft-com:xml-sql'> _ <sql:query>select <b>fname</b> from <b>XMLDTSTest</b> for xml auto _ </sql:query></ROOT>" oCmd.CommandText = sSQL oCmd.Dialect = "{5D531CB2-E6Ed-11D2-B252-00C04F681B71}" oCmd.Properties("Output Stream") = oDom oCmd.Execute , , 1024 oDom.Save "c:\xmldtsjay.xml" Main = DTSTaskExecResult_Success End Function

    The Result of this package

    The following picture shows the browser display of the XML file xmldtsjay.xml created by the above script. Isn't this neat?


    Summary

    The short answer for the question posed in the title is not a total 'no', but a partial 'yes'. The script based solution appears to be independent of DTS except for the last line in the code. Does it work outside of DTS? I have not tested it yet. Moreover, it used a different Provider -- SQLOLEDB. But perhaps the reason it works so well is because of the DOM support, and the fact that the query resembles that of a template query. For other questions regarding the above code, I direct the readers to the link at the beginning of this section.


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

       · Here is another interesting tutorial on DTS as related dealing with XML. There are...
     

    DATABASE ARTICLES

    - Building Applications with Anonymous Types
    - A Closer Look at Anonymous Types
    - Programming with Anonymous Types
    - Converting Your Excel Worksheet into a Worki...
    - Excel Reference
    - Database Programming in C# with MySQL : Usin...
    - Formatting Techniques for Data Access from E...
    - Data Access from Excel VBA
    - Generating a Multiple Table Crystal Report u...
    - ADO and the Command Object
    - On Wiring Up an ADO Data Control
    - Reading and Writing to Files on the Intranet
    - Using ADO Record to Create and Navigate Intr...
    - Using Data Access Pages to Access Data on a ...
    - Using ADO with the SQL Native Client





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek