Advertisement

10.11.2007 at 11:31AM PDT, ID: 22887838
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.8

SQL 2000 Transformation Script to SQL 2005 Data Flow Task?

Asked by irishm20 in MS SQL Server

Tags: , , , ,

SQL Server 2005 from SQL Server 2000

I have a "transformation script" in SQL Server 2000 that I would like to convert/use in SQL Server 2005 but I'm not sure the best route to take or how to make it work for that matter.  The idea behind the script is to evaluate a column and based upon a value, multiple destination columns are derived from a single source column.  Again, I'm not sure how to do this in the "Data Flow Task" of SQL Server 2005, any ideas?  Here's my old SQL Server 2000 script:

'**********************************************************************
'  Visual Basic Transformation Script
'************************************************************************

'  Copy each source column to the destination column
Function Main()

Select Case DTSSource("TranCode").Value

        Case "5"        '*****Process Batch Header Row
              DTSGlobalVariables("ServiceClass").Value = ""
                DTSGlobalVariables("CompanyName").Value = ""
                DTSGlobalVariables("CompanyDisc").Value = ""
                DTSGlobalVariables("CompanyId").Value = ""
                DTSGlobalVariables("StandardEntryClass").Value = ""
                DTSGlobalVariables("CompanyEntryDesc").Value = ""
                DTSGlobalVariables("CompanyDescDate").Value = ""
                DTSGlobalVariables("EffectiveEntryDate").Value = ""
                DTSGlobalVariables("SettlementDate").Value = ""
                DTSGlobalVariables("OriginatorStatus").Value = ""
                DTSGlobalVariables("OriginatingDFIId").Value = ""
                DTSGlobalVariables("BatchNumber").Value = ""

         If Mid(DTSSource("TranData"), 50, 3) = "TEL" OR Mid(DTSSource("TranData"), 50, 3) = "WEB" Then

                DTSGlobalVariables("ServiceClass").Value = Mid(DTSSource("TranData"), 1, 3)
                DTSGlobalVariables("CompanyName").Value = Mid(DTSSource("TranData"), 4, 16)
                DTSGlobalVariables("CompanyDisc").Value = Mid(DTSSource("TranData"), 20, 20)
                DTSGlobalVariables("CompanyId").Value = Mid(DTSSource("TranData"), 40, 10)
                DTSGlobalVariables("StandardEntryClass").Value = Mid(DTSSource("TranData"), 50, 3)
                DTSGlobalVariables("CompanyEntryDesc").Value = Mid(DTSSource("TranData"), 53, 10)
                DTSGlobalVariables("CompanyDescDate").Value = Mid(DTSSource("TranData"), 63, 6)
                DTSGlobalVariables("EffectiveEntryDate").Value = DateSerial(Cint(Mid(DTSSource("TranData"), 69, 2)) , Cint(Mid(DTSSource("TranData"), 71, 2)) , Cint(Mid(DTSSource("TranData"), 73, 2)) )
                DTSGlobalVariables("SettlementDate").Value = Mid(DTSSource("TranData"), 75, 3)
                DTSGlobalVariables("OriginatorStatus").Value = Mid(DTSSource("TranData"), 78, 1)
                DTSGlobalVariables("OriginatingDFIId").Value = Mid(DTSSource("TranData"), 79, 8)
                DTSGlobalVariables("BatchNumber").Value = Mid(DTSSource("TranData"), 87, 7)
        
      Else
            DTSGlobalVariables("StandardEntryClass").Value = "nonWebTel"
            'Main = DTSTransformStat_SkipRow
      End If

       Case "6"        '*****Process Entry Detail Record

      If DTSGlobalVariables("StandardEntryClass").Value <> "nonWebTel" Then

              DTSDestination("PostDate") = DTSGlobalVariables("EffectiveEntryDate").Value
                DTSDestination("TranType") = DTSGlobalVariables("StandardEntryClass").Value
                DTSDestination("CompanyName") = DTSGlobalVariables("CompanyName").Value
                DTSDestination("AccountNumber") = Mid(DTSSource("TranData"), 12, 17)
                DTSDestination("Amount") = FormatCurrency(Cdbl(Mid(DTSSource("TranData"), 29, 10))*.01,2)
                DTSDestination("IndividualName") = Mid(DTSSource("TranData"), 54, 22)
      Else
            DTSGlobalVariables("StandardEntryClass").Value = "nonWebTel"
            'Main = DTSTransformStat_SkipRow
      End If

Case Else
      'Main = DTSTransformStat_SkipRow
End Select

Main = DTSTransformStat_OK

End Function
Start Free Trial
[+][-]10.11.2007 at 12:36PM PDT, ID: 20060343

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.11.2007 at 12:39PM PDT, ID: 20060369

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.03.2008 at 02:41AM PDT, ID: 22375389

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]09.08.2008 at 05:01PM PDT, ID: 22422882

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: MS SQL Server
Tags: sql, 2005, script, transformation, data
Sign Up Now!
Solution Provided By: Computer101
Participating Experts: 2
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_1_20070628