Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server DTS
|
SQL Server DTS Discussion specific to Data Transformation Service with SQL Server. General SQL Server discussions should use the general SQL Server forum. Readers of the book Professional SQL Server 2000 DTS with questions specific to that book should post in that book forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server DTS section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 14th, 2004, 11:27 AM
Registered User
 
Join Date: May 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default String Concatenation in a DTS package.

Hello all,

I have been thrown to the wolves at my new job because the guy that was training me left abruptly. I am trying to figue out a DTS package and automate a task. A file gets placed on our ftp site once a week. The name of this file will change every week. The first part is achcon_ and the second part is fwxx with the xx being the fiscal week of the year, as in achcon_fw19 or achcon_fw20. I am trying to grab that file on our ftp site and move it to a working directory. Can't seem to get it to work. I have an e-mail after this code to notify me of a failure and that has been working.

I think my error is in concatenating the two strings.

Any help is apprieciated.

Code:
Function Main()

  Dim objFso 'File system object

  Set objFso = CreateObject("Scripting.FileSystemObject")
  DTSGlobalVariables("gv_strWklydir").value = "\\Database\WeeklyFiles\ACH\" ' Weekly directory
  DTSGlobalVariables("gv_strFTPDir").value = "\\Jax\D$\ClientFTP\GE\" ' FTP directory where ACH file gets uploaded
  DTSGlobalVariables("gv_strACHFile").value = "achcon_" & DTSGlobalVariables("gv_strFW").value & ".zip" ' ACH weekly file

  ' If the old update file exists, delete it.  This should never happen but just in case...
  If (objFso.FileExists(DTSGlobalVariables("gv_strWklydir").value & DTSGlobalVariables("gv_strACHFile").value)) Then
    objFso.GetFile(DTSGlobalVariables("gv_strWklydir").value & DTSGlobalVariables("gv_strACHFile").value).Delete
  End If

  ' Move the new ACH Group file to the weekly directory.
  If (objFso.FileExists(DTSGlobalVariables("gv_strFTPDir").value & DTSGlobalVariables("gv_strACHFile").value & DTSGlobalVariables("gv_strFW").value)) Then
    objFso.GetFile(DTSGlobalVariables("gv_strFTPDir").value & DTSGlobalVariables("gv_strACHFile").value).Move (DTSGlobalVariables("gv_strWklydir").value & DTSGlobalVariables("gv_strACHFile").value)
  Else      
    ' Email that the moving of the ACH file failed and exit the task,
    ' reporting a failure.
    strSubject = "GE Database - The moving of the ACH Group file failed."
    strMessage = "Hello DBAdmins," & vbCrLf & vbCrLf & "The moving of the ACH Group file " &_
                             DTSGlobalVariables("gv_strFW") & " failed.  Wassup?" & vbCrLf & vbCrLf & "Server"
    FrmtEmail strSubject, strMessage, strFileattachment
    Main = DTSTaskExecResult_Failure
    Exit Function
  End If

  Main = DTSTaskExecResult_Success

  Set objFso = Nothing

End Function
 
Old June 14th, 2004, 03:42 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 625
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to jemacc
Default

a few question.

1. Is the ftp site outside or side your fire wall?
2. Does account used to grab the file have access to the ftp site or folder your trying to access?

if number 1. then create a vbs script to move the file where you dts package can pick it up.
if number 2. Make sure the account has access to folders and FTP site.
 
Old June 30th, 2004, 11:54 AM
Registered User
 
Join Date: May 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

It is inside our firewall, and I do have access to the ftp directory. I have placed a achcon.txt file in the ftp directory and was able to move that just fine. It is just the concatenation of these two ("gv_strACHFile")and ("gv_strFW") that throws the error.

 
Old July 13th, 2004, 08:26 PM
Registered User
 
Join Date: Jul 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi there

try to remove the .Value portion from the Gloabal variables.
I am not sure but you can try that.



e.g.

objFso.GetFile(DTSGlobalVariables("gv_strFTPDir") & DTSGlobalVariables("gv_strACHFile")).Move (DTSGlobalVariables("gv_strWklydir") & DTSGlobalVariables("gv_strACHFile"))

cheers
Abhi







Similar Threads
Thread Thread Starter Forum Replies Last Post
Performance in String concatenation rushman XSLT 4 September 27th, 2007 11:02 AM
String concatenation query. AjayLuthria XSLT 2 March 14th, 2007 11:55 AM
string concatenation nulogix PHP How-To 1 June 24th, 2004 06:17 AM
string concatenation matt_99 Access VBA 2 January 17th, 2004 09:55 AM
T-SQL String Concatenation jaucourt SQL Language 2 January 13th, 2004 10:54 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.