May 5, 2014 at 9:36 am
I can't seem to get this to write to a user variable whose scope is at the package level. If I set breakpoints, the variables (local and user) are being set to an expected value. It just won't show in the variables list.
Imports System
Imports System.Data
Imports System.Math
Imports Microsoft.SqlServer.Dts.Runtime
<System.AddIn.AddIn("ScriptMain", Version:="1.0", Publisher:="", Description:="")> _
<System.CLSCompliantAttribute(False)> _
Partial Public Class ScriptMain
Inherits Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
Enum ScriptResults
Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success
Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
End Enum
Public Sub Main()
Dim Timestamp As String
'
' Add your code here
'
Timestamp = Now.Year.ToString() & Now.Month.ToString() & Now.Day.ToString() & Now.Minute.ToString() & Now.Second.ToString + Now.Millisecond.ToString
Dts.Variables.Item("User::FileName_Timestamp").Value = Timestamp
Dts.TaskResult = ScriptResults.Success
End Sub
End Class
May 5, 2014 at 9:59 am
IIRC the SSIS variables list shows only the default values. WHen you examine the vars at a breakpoint, you see the current values
May 5, 2014 at 10:03 am
Thank you. The only way I know to examine user variables during debugging is via Debug.Print. Is there a smarter way to do this?
May 5, 2014 at 10:31 am
nonghead-webspam (5/5/2014)
Thank you. The only way I know to examine user variables during debugging is via Debug.Print. Is there a smarter way to do this?
Use breakpoints.
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
May 5, 2014 at 10:36 am
Thank you. I am setting breakpoints. How do I look at a variable value when I hit a breakpoint, besides debug.print.
The variables list is not changing.
May 5, 2014 at 11:05 am
I was referring to setting breakpoints in SSIS, not in your script. You can set breakpoints on most tasks, both before and after they execute. Then, you run the whole package in debug. When a breakpoint hits, you can examine the variables in the window that pops up at the bottom of the VS session.
May 5, 2014 at 11:09 am
when you use break points, use the watch windows to view variables at run time.. you don't have to print them to view them..
Good Luck 🙂 .. Visit www.sqlsaga.com for more t-sql code snippets and BI related how to articles.
May 5, 2014 at 12:29 pm
ok, was able to get the watch list up. now things are working. One problem was, I only designated read/write variables, not readonly. It was blowing up without giving me a readily understandable error message.
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply