Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AlfieNoakes
Starting Member
14 Posts |
Posted - 2004-09-22 : 09:24:27
|
How, in my DTS Package, can I obtain the number of rows copied from a Transform Data task, and load them into a global variable?Thanks in advance! |
|
|
mwjdavidson
Aged Yak Warrior
735 Posts |
Posted - 2004-09-22 : 09:42:04
|
You could do it via an ActiveX Script using the RowsComplete property of the transform data task (create a global variable called gv_RowsComplete and replace "My Transform Data Task Name" with the name of the task in your package):'**********************************************************************' Visual Basic ActiveX Script'************************************************************************Function Main() Dim objPkg Dim objTask Dim objPump'create objects Set objPkg = DTSGlobalVariables.Parent Set objTask = objPkg.Tasks("My Transform Data Task Name") Set objPump = objTask.CustomTask'initialise global variable DTSGlobalVariables("gv_RowsComplete").Value = objPump.RowsComplete'destroy objects Set objPump = Nothing Set objTask = Nothing Set objPkg = Nothing'return success Main = DTSTaskExecResult_SuccessEnd FunctionHowever, depending on the source of your transformation, it may be easier to use an execute SQL taskMark |
 |
|
|
AlfieNoakes
Starting Member
14 Posts |
Posted - 2004-09-22 : 11:02:26
|
| Mark, I've applied your code to my DTS Package, as follows: Dim objPkg Dim objTask Dim objPump 'create objects Set objPkg = DTSGlobalVariables.Parent Set objTask = objPkg.Tasks("DTSStep_DTSDataPumpTask_1") Set objPump = objTask.CustomTask 'initialise global variable DTSGlobalVariables("intRowsAppendedToCDRTable").Value = objPump.RowsComplete 'destroy objects Set objPump = Nothing Set objTask = Nothing Set objPkg = Nothing 'return success Main = DTSTaskExecResult_Success--------------------------------------------------------------------------------------------However, if when I run the DTS Package, I get this error:Task "DTSStep_DTSDataPumpTask_1" not foundI think it's because the transformation task is actually a step. For example, this would work:set stpImportDCRFile = Objpkg.Steps("DTSStep_DTSDataPumpTask_1")Any ideas? |
 |
|
|
mwjdavidson
Aged Yak Warrior
735 Posts |
Posted - 2004-09-22 : 11:24:53
|
| It looks like you're referencing the step associated with that task rather than the task itself. Replace "DTSStep_DTSDataPumpTask_1" with "DTSTask_DTSDataPumpTask_1"Mark |
 |
|
|
AlfieNoakes
Starting Member
14 Posts |
Posted - 2004-09-22 : 11:36:39
|
| Thank you, that fixed the problem! |
 |
|
|
ramakanth_gupta
Starting Member
5 Posts |
Posted - 2004-09-24 : 03:06:31
|
| choose the data transformation as insert success and declare a global variable (for row count).choose activex task in dts_transformationin the activeX task u just increment the global variable then after transformation u will get the no of rows transformed |
 |
|
|
|
|
|
|
|