Scripting the Profile Data Import DTS Task
The following script creates and runs the Profile Data Import DTS task. You can use this script in two ways to create a package that contains the DTS task to run:
You can run the package on the command line by using the command DTSRun.exe. The file DTSRun.exe is automatically installed on your server when you install SQL Server.
You can copy the script into a Visual Basic script (.vbs) file and run it by using CScript as follows:
[drive]:cscriptfilename.vbs
For a description of the Profile Data Import DTS task, see Commerce Server DTS Tasks.
Use the Site Level Profile Data Import script to import data at the site level. Use the Data Warehouse Profile Data Import script to import data at the Data Warehouse level.
Site Level Profile Data Import
'*********************************************************************
' Site Level Profile Data Import DTS Task
' This script creates a DTS package and runs it.
'**********************************************************************
Dim oPackage
Dim oTask
Dim oStep
Dim oProps
Dim oTaskProps
set oPackage = WScript.CreateOBject("DTS.Package")
'******************************************************************
' Define package properties.
'******************************************************************
oPackage.Name = "Profile Data Import DTS Task"
oPackage.Description = "Imports user profile data into the Data Warehouse."
'******************************************************************
' Create a task.
'******************************************************************
Set oTask = oPackage.Tasks.New("CS_UpmDtsTask.DTSUPMCustomTask")
oTask.Name = "Task1"
oTask.Description = "Creates a task for ProfileDataImport DTS"
Set oTaskProps = oTask.Properties
'*******************************************************************
' Set DTS task properties.
'*******************************************************************
oTaskProps("SourceType").value = 0
' Make sure SourceName is set to the correct Web site name.
oTaskProps("SourceName").value = "BlankSite"'Put the proper site name here
oTaskProps("DTSTaskImportStartDate").value = #01/01/2002# 'Put the proper date here
oTaskProps("NumRetries").value = 3
oTaskProps("RetryInterval").value = 30
oTaskProps("DTSTaskTimeQuantum").value = 15
oTaskProps("ProcessingType").value = 0
oPackage.Tasks.Add oTask
'******************************************************************
' Create a step.
'******************************************************************
Set oStep = oPackage.Steps.New
oStep.Name = "Step1"
oStep.TaskName = "Task1"
'For custom tasks written in Visual Basic, the steps cannot run on a
' secondary thread.
oStep.ExecuteInMainThread = True
oPackage.Steps.Add oStep
' ******************************************************************
' Execute the package.
' ******************************************************************
oPackage.Execute
For I = 1 To oPackage.Steps.Count
If oPackage.Steps(I).ExecutionResult = 1 Then
iStatus = False
MsgBox oPackage.Steps(I).Name + " in the " + _
oPackage.Name + " failed."
End If
Next
MsgBox oPackage.Name + " Done"
Set oStep = Nothing
Set oTaskProps = Nothing
Set oProps = Nothing
Set oTaskProps = Nothing
Set oPackage = Nothing
Data Warehouse Profile Data Import
'*********************************************************************
' Dat Warehouse Profile Data Import DTS Task
' This script creates a DTS package and runs it.
'**********************************************************************
Dim oPackage
Dim oTask
Dim oStep
Dim oProps
Dim oTaskProps
set oPackage = WScript.CreateOBject("DTS.Package")
'******************************************************************
' Define package properties.
'******************************************************************
oPackage.Name = "Profile Data Import DTS Task"
oPackage.Description = "Imports user profile data into the Data Warehouse."
'******************************************************************
' Create a task.
'******************************************************************
Set oTask = oPackage.Tasks.New("CS_UpmDtsTask.DTSUPMCustomTask")
oTask.Name = "Task1"
oTask.Description = "Creates a task for ProfileDataImport DTS"
Set oTaskProps = oTask.Properties
'*******************************************************************
' Set DTS task properties.
'*******************************************************************
oTaskProps("SourceType").value = 1
' Make sure SourceName is set to the correct Data Warehouse name.
oTaskProps("SourceName").value = "Data Warehouse 1"
oTaskProps("DTSTaskImportStartDate").value = #01/01/2002# 'Put the proper date here
oTaskProps("NumRetries").value = 3
oTaskProps("RetryInterval").value = 30
oTaskProps("DTSTaskTimeQuantum").value = 15
oTaskProps("ProcessingType").value = 100
oPackage.Tasks.Add oTask
'******************************************************************
' Create a step.
'******************************************************************
Set oStep = oPackage.Steps.New
oStep.Name = "Step1"
oStep.TaskName = "Task1"
'For custom tasks written in Visual Basic, the steps cannot run on a
' secondary thread.
oStep.ExecuteInMainThread = True
oPackage.Steps.Add oStep
' ******************************************************************
' Execute the package.
' ******************************************************************
oPackage.Execute
For I = 1 To oPackage.Steps.Count
If oPackage.Steps(I).ExecutionResult = 1 Then
iStatus = False
MsgBox oPackage.Steps(I).Name + " in the " + _
oPackage.Name + " failed."
End If
Next
MsgBox oPackage.Name + " Done"
Set oStep = Nothing
Set oTaskProps = Nothing
Set oProps = Nothing
Set oTaskProps = Nothing
Set oPackage = Nothing