*********************************************************** *********
Author: Huangshan Guangmingding
Mail: leimin.ray@gmail.com
Version: 1.0.0
Date: 2004-1-30
(If you need to reprint, please indicate the source! If you have any questions, please send me Mail :-))
*********************************************************** **********
There are often some netizens asked how to call some scripts and objects on the client, and you can enter parameters. I will explain how to call the DTS package for SQLServer on the client, and you can enter the parameters, and you can record the log:
test environment:
Server: PIII866 512MB RAID5
Windows 2000 Server SP4; SQLServer2000 SP3
Client: Windows 2000 Pro SP4 SQLServer2000 Client SP3
1. Create a DTS package first on the Server side:
This can be done according to the finish step by step, I will not say much. For example, my door has established a DTS package that imports Excel files to SQL Server: DTS_EXCELTOSQLSERVER
2. Create a batch file in the client Crundts.bat
3. Edit with text editor:
@@ echo off
IF [% 1] == [] goto usageif [% 2] == [] goto usageif [% 3] == [] goto usageif [% 4] == [] GOTO USAGECLS
Set logfile = c: /dtsrun.log
Echo% Time% Manual DTS Package Start Run ......... >>% logfile% echo -------------------------- ---------------- >>% logfile%
@DTSRUN / S% 1 / U% 2 / P% 3 / N% 4 >>% logfile% if Errorlevel 1 goto error
Echo% Time% Manual DTS package end ......... >>% logfile% echo --------------------------- --------------- >>% logfile% Pausego Finish
: ErroRecho ------------------------------------------- >>% logfile% Echo dtsrun error pls check log ......... echo% Time% globalstore backup abnormal end. >>% logfile% PAUSEGOTO FINISH
: Usageecho.echo usage: crundts% 1 ServerName% 2 USE_NAME% 3 Password% 4 dts_name: finish
4. Save the file:
Then you can call in any program, you can also perform it manually, enter parameters
5. Test operation:
Run at the DOS prompt: Crundts Servername Sa Password DTS_EXCELTOSQLSERVER
6. Log information:
10: 24: 29.38 Manual DTS Package Start Run ......... ------------------------------- ----------- DTSRun: loading ... error: -2147217900 (80040E14); Provider Error: 14262 (37B6) Error String: Error Source: Help File: Help Context: 0
10: 24: 29.66 Manual DTS Package End ......... -------------------------------- ---------- 10: 27: 29.41 Manual DTS Package Start Run ......... --------------------- --------------------- DTSRun: Loading ... DTSRun: Executing ... DTSRun OnStart: DTSStep_DTSDataPumpTask_1DTSRun OnProgress: DTSStep_DTSDataPumpTask_1; 23 Rows have been transformed or copied .; Percentcomplete = 0; progresscount = 23dtsrun onfinish: dtsstep_dtsdatapumptask_1dtsrun: package execution completion completion complex: Package Execution completion, -------------------------