MS SQL Server
  Home arrow MS SQL Server arrow Page 2 - Using Data Transformation Services: Using ...
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: Using DTS Lookups, Introduction
By: Jayaram Krishnaswamy
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 20
    2005-08-24

    Table of Contents:
  • Using Data Transformation Services: Using DTS Lookups, Introduction
  • DTS Lookup with multiple arguments
  • Example continued
  • DTS Lookup returning multiple values

  • 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: Using DTS Lookups, Introduction - DTS Lookup with multiple arguments


    (Page 2 of 4 )

    In this next example, you are given the last name of the author and the name of the state in which the author resides, and you must find the title of the books he has written. In order to access such data you may need to make 'joins' as shown in the script. You may also notice two place holders represented by the ? mark.

    SELECT     titles.title
    FROM         authors INNER JOIN
    titleauthor ON authors.au_id = titleauthor.au_id
    INNER JOIN titles ON titleauthor.title_id = titles.title_id WHERE (authors.au_lname = ?) AND (authors.state = ?)

    Multiple arguments example

    We first create a package, called NewLookups as shown here. The procedure is described in detail in earlier tutorials.

    MS Access database and SQL 2000 Server database are the two connections used for this tutorial. These are shown in the next two pictures.

    The following query selects some columns from the SQL 2000 Server and, using the DTS, populates a destination table.

    SELECT     authors.au_lname, authors.phone, authors.state, 
    authors.zip, titles.title, titles.price
    FROM   authors INNER JOIN
    titleauthor ON authors.au_id = titleauthor.au_id 
    INNER JOIN
    titles ON titleauthor.title_id = titles.title_id
    

     

     

    The transformation has not only populated the destination table with the selected columns from the source, but also extracted the field 'title' from the lookup query against the source to populate the destination table. The following Transform Data Task has such a property. Although this is a finished product, the following sequence may help you understand.

    Since we need to get the 'title' field from the lookup query, we click on the tab lookups which brings up the next window. In the first column, you may give any meaningful name to your query (here, it is GetTitle). in the next column, you need to pick a connection; for this example the same SQL Server is used. It is possible, and sometimes advisable, to create another connection. It is also possible to cache the results -- not configured in the present case. Now the query itself needs to be coded using the user interface query designer. This is invoked by clicking on the ellipsis button in the query column.

    More MS SQL Server Articles
    More By Jayaram Krishnaswamy


       · Most of the articles on DTS written by me including the present one use the...
       · Hi,I am pretty new to DTS but not to ETL. One of the major requirements I have...
     

    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 1 hosted by Hostway
    Stay green...Green IT