Often some netizens ask how to invoke some scripts and objects on the SQL Server side of the client, and you can enter parameters, and I'll give you an example of how to invoke SQL Server's DTS package on the client, and you can enter parameters and log:
Test environment:
Server: PIII866+512MB +RAID5
WINDOWS SERVER+SP4; Sqlserver2000+sp3
Client: WINDOWS pro+sp4+sqlserver2000 client+sp3
1. First set up a DTS package on the server side:
This can be done step-by-Step by the wizard, I will not say more. Like our door. A DTS package that imports Excel files to SQL Server is established: Dts_exceltosqlserver
2. Create a batch file on the client
Crundts. BAT
3. Edit with a text editor:
@ @echo Off
If [%1] = = [] Goto Usage
if [%2] = = [] Goto Usage
if [%3] = = [] Goto Usage
if [%4] = = [] Goto Usage
Cls
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%
PAUSE
Goto FINISH
: Error
echo------------------------------------------->>%logfile%
echo DTSRUN ERROR PLS CHECK LOG ...
echo%time% globalstore Backup abnormal end. >>%logfile%
Pause
Goto FINISH
: Usage
Echo.
echo Usage:crundts%1 servername%2 use_name%3 password%4 dts_name
: FINISH
4. Save the file:
Then you can call it in any program, or you can do it manually, enter the parameters
5. Test run:
Run at a 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_1
DTSRun Onprogress:dtsstep_dtsdatapumptask_1; Rows have been transformed or copied.; PercentComplete = 0; Progresscount = 23
DTSRun Onfinish:dtsstep_dtsdatapumptask_1
Dtsrun:package execution complete.
10:27:30.02 Manual DTS Package end .....
------------------------------------------