March 30, 2010 at 4:50 pm
Hi,
I want get the latest backup file from a directory and zip it. My backup files are with datetime stamps. So, I used script task to get the latest file. But, I am not able to use this parameter as a input arguments for execute process task, I am getting can not lock variable value error. Any suggestion?
Thank you,
-VG
March 31, 2010 at 1:23 am
--sorry, misread post & answered incorrectly
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
March 31, 2010 at 9:02 am
are u passing this variable as an argument.. Can you post a detailed error??
March 31, 2010 at 12:55 pm
SSIS package "Package.dtsx" starting.
Error: 0xC0014054 at Execute Process Task: Failed to lock variable "D:\SSIS\SQLBackups\G_backup_201003250030.bak" for read access with error 0xC0010001 "The variable cannot be found. This occurs when an attempt is made to retrieve a variable from the Variables collection on a container during execution of the package, and the variable is not there. The variable name may have changed or the variable is not being created.".
Error: 0xC002F304 at Execute Process Task, Execute Process Task: An error occurred with the following error message: "Failed to lock variable "D:\SSIS\SQLBackups\G_backup_201003250030.bak" for read access with error 0xC0010001 "The variable cannot be found. This occurs when an attempt is made to retrieve a variable from the Variables collection on a container during execution of the package, and the variable is not there. The variable name may have changed or the variable is not being created.".
".
Task failed: Execute Process Task
March 31, 2010 at 12:59 pm
Is it a package level variable or task level.. If its a task level or limited to the FEL task only change it Package level variable
March 31, 2010 at 1:10 pm
It is Package level variable....
I have this in script task: and mesagebox gives me the varaible value, but this is not passed to execute process task.
Imports System
Imports System.Data
Imports System.Math
Imports Microsoft.SqlServer.Dts.pipeline.wrapper
Imports Microsoft.SqlServer.Dts.Runtime.wrapper
Imports System.Windows.Forms
Imports System.IO
Imports System.Collections.Generic
Public Class ScriptMain
Public Sub Main()
Dim rootDi As New DirectoryInfo("D:\SSIS\SQLBackups\")
Dim newestFile As String
'Dim ZipDirectory As String
Dim fileDate As Integer
Dim fileDateSaved As Integer = 0 'initialize variable
For Each fi As FileInfo In rootDi.GetFiles("*.bak")
fileDate = CInt(fi.Name.Substring(11, 8)) 'set to current file date in loop
If fileDate > fileDateSaved Then
fileDateSaved = fileDate
newestFile = "D:\SSIS\SQLBackups" + fi.Name 'set variable to fName loop variable
Dts.Variables("newestFile").Value = "D:\SSIS\SQLBackups\" + fi.Name.ToString
End If
Next
MsgBox(newestFile)
Dts.TaskResult = Dts.Results.Success
End Sub
End Class
March 31, 2010 at 1:26 pm
Got it working....Adding the variables to exepression for arguments of execute process task worked.
I added like this- @[User::ZipDirectory] + " "+ @[User::newestFile]
-VG
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply