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.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 passing parameters to bcp

Author  Topic 

alejo46
Posting Yak Master

157 Posts

Posted - 2013-07-08 : 14:39:16
good afternoon
I if need your help.
1st is there any web page you can tell me a the basics of activeX, the langauge, code,etc ?

2. I need to modify the code of this ActiveX in order to pass the parameters:This is the bcp path:
\\datamartsql\programas\Bajar_Tabla.bat
the bajar_tabla.bat file content is:
bcp %1 out %2 -c -t"|" -Sdatamartsql -T
%1 and %2 are parameters ? which are the values for each one of these parameters ?

the code for the former activeX that pass the parameters out is:

********Asignación de parámetros al BCP
iContador = 1
bBuscar = true
ls_Nomarch = Trim(DTSGlobalVariables("V_RUTA_CONFIG").Value) & "Bajar_Tabla.bat " & _
"dm1_elite.dbo." & DTSGlobalVariables("V_NOMBRE_TABLA").Value & " " & DTSGlobalVariables("V_NOMBRE_ARCHIVO").Value & v_servidor & " " & v_usuario & " " & v_password

Set oPackage = DTSGlobalVariables.parent

Do While bBuscar
'*******Asignar un elemento de la colección tareas del paquete a una variable objeto tarea
Set oTask = oPackage.Tasks.Item(iContador)
If Trim(oTask.Description) = "BCP para generar archivo" Then
bBuscar = False
Else
iContador = iContador + 1
End If
Loop
Set oCTR = oTask.CustomTask
oCTR.ProcessCommandLine = ls_nomarch
Set oCTR = nothing
Set oTask = nothing
Set oPackage = nothing

Main = DTSTaskExecResult_Success

alejo46
Posting Yak Master

157 Posts

Posted - 2013-07-09 : 15:58:41
what i intended is to replace this bcp command like this:

bcp %1 out %2 -c -t"|" -Sdatamartsql -T
by this one:

bcp "SELECT * FROM dm1_elite.dbo.SALDOS_PREPAGO_DIARIOS_ALTAMIRA_SALDOS where FEC_SALDO >= '20120816'and FEC_SALDO <= '20120823'" queryout d:\SALDOS_PREPAGO_DIARIOS_ALTAMIRA_SALDOS_20120816_20120823.txt -c -t"|" -Sdatamartsql -T
but i can't identify the parameters value given by bcp %1 out %2
thanks in advanced
Go to Top of Page

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2013-07-10 : 02:48:24
I am struggling with the espanol, but what you want to do is build a string, then execute it.

You could even use FileSystemObject to build a batch file and the execute that.

ActiveX can be JavaScript or vbScript. Have a look here for starters
Go to Top of Page

alejo46
Posting Yak Master

157 Posts

Posted - 2013-07-12 : 16:34:25
OK thanks, but i stiil dont know the the values for both parameters %1 and %2 given by ActiveX and passed to bcp:
bcp %1 out %2 -c -t"|" -Sdatamartsql -T

2nd the link you mention to start learning Activex is temporaly unavailable becuse it yields the error: 404 page cannot be found

Thnks in advance
Go to Top of Page
   

- Advertisement -