Microsoft SQL Server
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft SQL Server

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old October 27th, 2004, 05:12 AM
Paula Paula is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 65 Paula User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 37 m 32 sec
Reputation Power: 5
Unhappy Problem with DTS Script - please help!

Hi all,

Please can anyone help me with this? When I run the following script in SQL Server I get the error "Microsoft VBScript compilation error, expected 'Function', line 35.

Line 35 is the line with the IF statement, so that is obviously the problem, but I have done exactly the same thing before with another script and it works. The datatypes of the source and destination are the same, the lengths are different obviously. Any ideas?

'************************************************* *********************
' Visual Basic Transformation Script
' Copy each source column to the
' destination column
'************************************************* ***********************
Function Main()
DTSDestination("Prac_Code") = DTSSource("Practice Code")
DTSDestination("Name") = DTSSource("Practice")
DTSDestination("List_Size") = DTSSource("List Size")
DTSDestination("PCG") = DTSSource("PCG")
DTSDestination("Add1") = DTSSource("Address1")
DTSDestination("Add2") = DTSSource("Address2")
DTSDestination("Add3") = DTSSource("Town")
DTSDestination("Add4") = DTSSource("BOROUGH")
DTSDestination("Pcode") = DTSSource("Post Code")
DTSDestination("Tel") = DTSSource("Tel")
DTSDestination("Fax") = DTSSource("Fax")
DTSDestination("Premises_Note") = DTSSource("PremisesNote")
DTSDestination("PMS") = DTSSource("PMS")
DTSDestination("PMS_Notes") = DTSSource("PMS Notes")
DTSDestination("Note") = DTSSource("Note")
DTSDestination("Num_Prncpls") = DTSSource("No of Prncpls")
DTSDestination("Rent") = DTSSource("Rent£")
DTSDestination("Ave_per_WTE") = DTSSource("Ave per WTE")
DTSDestination("Num_Sal_GP") = DTSSource("No Sal GPs")
DTSDestination("Vacancies_WTE") = DTSSource("VacanciesWTEs")
DTSDestination("Type_Rent") = DTSSource("Type of Rent")
DTSDestination("B_Type_Rent") = DTSSource("BType of Rent")
DTSDestination("Branch_Rent") = DTSSource("Brent£")
DTSDestination("Out_of_Hours") = DTSSource("OOH")
DTSDestination("WTE_Detail") = DTSSource("WTE Detail")
DTSDestination("WTE_Date") = DTSSource("WTEDate")
DTSDestination("Train_Practice") = DTSSource("TrgPract")
If DTSSource("Branch") = "Yes" then DTSDestination("Branch") = "Y"
End If
If DTSSource("Branch") = "No" then DTSDestination("Branch") = "N"
End If
DTSDestination("Branch_Add1") = DTSSource("Baddress1")
DTSDestination("Branch_Add2") = DTSSource("Baddress2")
DTSDestination("Branch_Add3") = DTSSource("Btown")
DTSDestination("Branch_Pcode") = DTSSource("Bpost code")
DTSDestination("Branch_Tel") = DTSSource("BTel")
Main = DTSTransformStat_OK
End Function


Thank you !

Reply With Quote
  #2  
Old October 27th, 2004, 08:48 AM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
ASP Free God 14th Plane (11500 - 11999 posts)
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,760 Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 5 h 18 m 17 sec
Reputation Power: 443
Remove the two "End If" statements.
Since your If statement is on a single line you don't need End Ifs.
Example:
Code:
You need "End If" for this
If DTSSource("Branch") = "Yes" then 
   DTSDestination("Branch") = "Y"
End If

You don't need "End If for this
If DTSSource("Branch") = "Yes" then DTSDestination("Branch") = "Y"

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft SQL Server > Problem with DTS Script - please help!


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway