Script Task hangs

  • I have a for loop control which loops through a series of activities based on a date. I am trying to use a script task to move to the next date as the final step of the loop, but it just hangs.

    Here is the script task:

    Imports System

    Imports System.Data

    Imports System.Math

    Imports Microsoft.SqlServer.Dts.Runtime

    Public Class ScriptMain

    Public Sub Main()

    '

    Dim vars As Variables

    Dts.VariableDispenser.LockOneForWrite("Rundate", vars)

    vars("Rundate").Value = DateAdd(CStr(DateInterval.Day), 1, vars("Rundate").Value)

    '

    Dts.TaskResult = Dts.Results.Success

    End Sub

    End Class

  • Yup. It will event ually timeout with a deadlock error.

    You are reading from the variable while trying to write to it.

    Do it in two steps.

    Cheers,CrispinI can't die, there are too many people who still have to meet me!It's not a bug, SQL just misunderstood me!

  • Cheers Crispin - that's the prob

  • NP

    What surprises me was the lack of timeout or did you cancel it to quickly. I believe it is 30 second. (I guess I would have canceled it too)

    Cheers,CrispinI can't die, there are too many people who still have to meet me!It's not a bug, SQL just misunderstood me!

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply