December 27, 2006 at 12:53 am
hi i want to copy a zip mfile from one location to other after renaming it in DTS Packages using VB Script.
December 28, 2006 at 12:29 am
You can use tsql instead VB script use rename and copy the file...
exec xp_cmdshell 'rename \\servername\c$\filename.zip filename_new.zip'
exec xp_cmdshell 'copy \\servername\c$\filename_new.zip \\servername\d$\filename_new.zip'
If you want to use in DTS execute the above code in EXECUTE SQL task...
MohammedU
Microsoft SQL Server MVP
December 28, 2006 at 3:23 am
Alternatively you could use a scripting task and the FSO to avoid using xp_cmdshell
Dim oFSO
Dim sDestinationFile
Dim sDestinationPath
Dim sSourceFile
Dim sSourcePath
sSourcePath = "YourSourcePath"
sSourceFile = sSourcePath & "YourZip.zip"
sDestinationPath = "YourDestinationPath"
sDestinationFile = sDestinationPath & "YourNewName.zip"
Set oFSO = CreateObject("Scripting.FileSystemObject")
If oFSO.FileExists(sDestinationFile) Then
oFSO.DeleteFile sDestinationFile
End If
oFSO.MoveFile sSourceFile, sDestinationFile
Main = DTSTaskExecResult_Success
-------------------------------------------------------------------------
Normal chaos will be resumed as soon as possible. :crazy:
December 28, 2006 at 3:48 am
hi john,
thanks ,
just let me know do i have to declare anything else in the script to get access.
i am not able to run it ....
its giving me the error...
as i am new to this sql server i dont know how to declare things...
plz help me out....
December 28, 2006 at 4:02 am
What error are you getting?
The script is a straight copy from one that is in use on our servers.
-------------------------------------------------------------------------
Normal chaos will be resumed as soon as possible. :crazy:
December 28, 2006 at 4:35 am
hi mohammed,
can you tell me how to run the sql commands in DTS Activex scripts?
like the exec xp_cmdshell ----
December 28, 2006 at 4:36 am
can u tell me how to wripe sql command in DTS Activex
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply