MS SQL Server
  Home arrow MS SQL Server arrow Page 8 - Using Data Transformation Services, part 4...
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  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Mobile Linux 
App Generation ROI 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
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? 
MS SQL SERVER

Using Data Transformation Services, part 4: Using the DTS Designer Objects (continued-2)
By: Jayaram Krishnaswamy
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 16
    2005-06-06

    Table of Contents:
  • Using Data Transformation Services, part 4: Using the DTS Designer Objects (continued-2)
  • Scenario of Data Transfer
  • Data Transfer Source
  • Data Transfer Destination
  • The Transform Data Task
  • Using the Transform Task
  • Column Transformation Code: Step 1
  • Column Transformation Code: Step 2
  • Column Transformation Code: Step 3
  • Executing the Package

  • 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, part 4: Using the DTS Designer Objects (continued-2) - Column Transformation Code: Step 2


    (Page 8 of 10 )

    In this case we shall take the date column and clean up the formatting so that when it gets transferred the date will be in a simpler format (yep,  your manager wanted this way!). The details follow along the same lines and we shall jump right to the ActiveX Script Transformation Properties window after doing the essentials of identifying the column, deleting the existing mapping, calling for a new mapping that brings up the ActiveX Script Transformation window. This shown in the next picture. The date format in the source, is of the form,

    YYYY-MM-DD 00:00:00.

    This needs to be changed to YYYY-MM-DD format. It was mentioned that you may add commands, control flow statements by clicking on the keyword from the left into the scripting text area box. If you click on, say MsgBox you will see the following added to the scripting area:

    MsgBox( <<prompt>> , <<buttons>> , <<title>> , <<helpfile>> , <<context>> )

    This is a helpful syntax that you should use although it has these weird angle brackets. Now in order to extract the first ten characters from this you could use the VB Script's LEFT() function. The following statement would convert the format to the desired format:

    DTSDestination("Col002") =Left(DTSSource("Col003") , 10 )

    This is shown in the next picture.

    The result of this transformation in the View data window is  as shown in the next picture. Your manager may want to see 05/01/1992 instead of 1992-05-01, but then, you have the full scripting power of VB script to make this change in code.

    Close all screens to return to the Transform Data Task Properties window as shown. In preparation for the next step, the mapping of column Col004  has been deleted in this picture.

    More MS SQL Server Articles
    More By Jayaram Krishnaswamy


     

    MS SQL SERVER ARTICLES

    - Completing the Introduction to Transact-SQL
    - A Brief Introduction to Transact-SQL
    - Lookups and Blocking Bad Data
    - Field Validation Rules for Blocking Bad Data
    - Using Masks to Block Bad Data
    - Blocking Bad Data
    - Using @@ROWCOUNT and TABLE Variables for Dat...
    - How to Use Variables, IF and CASE in Databas...
    - Creating Important Aspects of Notification S...
    - Working wth Variables in Database Interactio...
    - Delving Deeper into Notification Services
    - Notification Services
    - Building a Multi-table Report with SQL 2005 ...
    - A Secure Way of Building Connection Strings
    - Transferring a Database Using the SSIS Desig...





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
    Stay green...Green IT