dbTalk Databases Forums  

active x vbs problem

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss active x vbs problem in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
ChrisR
 
Posts: n/a

Default active x vbs problem - 12-13-2004 , 02:55 PM








DTS doesnt like my syntax for various reasons. Im trying to go from an Excel
file to an sql table. If there are only 4 digits, I want to add a "0". If
not, just do a regular import. Ive added comments so everyone know what line
is really where since wrapping is occuring here.

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

if len(DTSSource("machine_placement_id")) = 4 then
DTSDestination("StoreNbr") = "0" & DTSSource"machine_placement_id")
else DTSDestination("StoreNbr") = DTSSource("machine_placement_id") --
line 8
end if
Main = DTSTransformStat_OK
End Function



Expected End.
Error on line 8.

--
SQL2K SP3

TIA, ChrisR



Reply With Quote
  #2  
Old   
ChrisR
 
Posts: n/a

Default Never Mind - 12-13-2004 , 03:40 PM







"ChrisR" <bla (AT) noemail (DOT) com> wrote

Quote:

DTS doesnt like my syntax for various reasons. Im trying to go from an
Excel
file to an sql table. If there are only 4 digits, I want to add a "0". If
not, just do a regular import. Ive added comments so everyone know what
line
is really where since wrapping is occuring here.

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

if len(DTSSource("machine_placement_id")) = 4 then
DTSDestination("StoreNbr") = "0" & DTSSource"machine_placement_id")
else DTSDestination("StoreNbr") = DTSSource("machine_placement_id") --
line 8
end if
Main = DTSTransformStat_OK
End Function



Expected End.
Error on line 8.

--
SQL2K SP3

TIA, ChrisR





Reply With Quote
  #3  
Old   
Darren Green
 
Posts: n/a

Default Re: active x vbs problem - 12-13-2004 , 04:03 PM



In message <#mWs6XV4EHA.3644 (AT) tk2msftngp13 (DOT) phx.gbl>, ChrisR
<bla (AT) noemail (DOT) com> writes
Quote:

DTS doesnt like my syntax for various reasons. Im trying to go from an Excel
file to an sql table. If there are only 4 digits, I want to add a "0". If
not, just do a regular import. Ive added comments so everyone know what line
is really where since wrapping is occuring here.

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

if len(DTSSource("machine_placement_id")) = 4 then
DTSDestination("StoreNbr") = "0" & DTSSource"machine_placement_id")
else DTSDestination("StoreNbr") = DTSSource("machine_placement_id") --
line 8
end if
Main = DTSTransformStat_OK
End Function



Expected End.
Error on line 8.

--
SQL2K SP3

TIA, ChrisR


Looks like an error in -

"0" & DTSSource"machine_placement_id")

Should be -

"0" & DTSSource("machine_placement_id")


Just preference but I would use this to get a 5 character zero padded
value-

Function Main()

DTSDestination("StoreNbr") = Right("0" &
DTSSource("machine_placement_id").Value, 5)

Main = DTSTransformStat_OK

End Function

Depending on the types involved, you may need to convert the values
explicitly, e.g. CStr(X)


--
Darren Green (SQL Server MVP)
DTS - http://www.sqldts.com

PASS - the definitive, global community for SQL Server professionals
http://www.sqlpass.org



Reply With Quote
Reply




Thread Tools
Display Modes

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



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.