Assembly: Microsoft.SqlServer.ScriptTask (in microsoft.sqlserver.scripttask.dll)
Although you can call the task constructor, you typically create the task as a member of a package.
In the following example, the properties and methods of the ScriptTask are available using Properties of the TaskHost variable, th. For more information about casting the task, see the remarks in Add.
Package pkg = new Package(); Executable exec1 = pkg.Executables.Add("STOCK:ScriptTask"); TaskHost th = exec1 as TaskHost; // You can cast the InnerObject of the TaskHost // to the specific class. // For the code samples, task properties are accessed by using // the properties of the TaskHost. // ScriptTask myTask = th.InnerObject as ScriptTask;