Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

Setting variables works in VS 2017 but does not work when deployed

$
0
0

I am using this to set an End Date and Start Date for a report.

Public Sub Main()
        Dim Startdate As Date = DateAdd(DateInterval.Day, -1, DateTime.Now)
        Dim Enddate As Date = DateTime.Now

        Dts.Variables("User::StartDate").Value = DatePart("yyyy", Startdate) & "-" & Right("0" & DatePart("m", Startdate), 2) & "-" & Right("0" & DatePart("d", Startdate), 2)

        Dts.Variables("User::EndDate").Value = DatePart("yyyy", Enddate) & "-" & Right("0" & DatePart("m", Enddate), 2) & "-" & Right("0" & DatePart("d", Enddate), 2)

        '
        ' Add your code here
        '
        Dts.TaskResult = ScriptResults.Success
    End Sub

This works fine in Visual Studio 2017. But when I deploy it to SSIS Catalog in SQL 2016 and create a scheduled job, the Start Date and End Date is not set as desired when executed. Instead it uses the initial value I set when I created the variables




Viewing all articles
Browse latest Browse all 24688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>