Foros del Web » Programación para mayores de 30 ;) » Bases de Datos General »

DTS: utilizar variable global como valor a actualizar en columna

Estas en el tema de DTS: utilizar variable global como valor a actualizar en columna en el foro de Bases de Datos General en Foros del Web. tengo la tabla XXX campo1 integer campo2 char(20) tengo un DTS que recibe una variable global VARGLO ejecuto el dts desde visual basic enviandole como ...
  #1 (permalink)  
Antiguo 20/07/2005, 18:09
Avatar de acervantes  
Fecha de Ingreso: agosto-2003
Ubicación: Madrid
Mensajes: 311
Antigüedad: 20 años, 8 meses
Puntos: 1
DTS: utilizar variable global como valor a actualizar en columna

tengo la tabla XXX
campo1 integer
campo2 char(20)

tengo un DTS que recibe una variable global VARGLO

ejecuto el dts desde visual basic enviandole como parámetro 10 (VARGLO)

quiero hacer lo siguiente dentro del DTS

update XXX
set campo1 = VARGLO

no reemplaza nada

en realidad este es un ejemplo pero quisiera hacer algo parecido, es decir mediante update utilizar el valor de una variable global
__________________
ACervantes

[El éxito dura hasta que alguien las caga; los errores son eternos]
  #2 (permalink)  
Antiguo 21/07/2005, 14:25
Avatar de Mithrandir
Colaborador
 
Fecha de Ingreso: abril-2003
Mensajes: 12.106
Antigüedad: 21 años
Puntos: 25
En TSQL tradicional las variables van precedidas de "@" de manera que VARGLO sería en realidad @VARGLO, pero desconozco de que forma se traten en las variables globales de DTS.
__________________
"El hombre, en su orgullo, creó a Dios a su imagen y semejanza."
Friedrich Nietzsche
  #3 (permalink)  
Antiguo 21/07/2005, 15:32
Avatar de acervantes  
Fecha de Ingreso: agosto-2003
Ubicación: Madrid
Mensajes: 311
Antigüedad: 20 años, 8 meses
Puntos: 1
???
es para DTS
gracias
__________________
ACervantes

[El éxito dura hasta que alguien las caga; los errores son eternos]
  #4 (permalink)  
Antiguo 22/07/2005, 14:45
Avatar de Mithrandir
Colaborador
 
Fecha de Ingreso: abril-2003
Mensajes: 12.106
Antigüedad: 21 años
Puntos: 25
Este es un extracto de los books online de sql:
Cita:
Creating and Using Global Variables
To create a global variable in a DTS package prior to package execution, use the New method of the Package2 object GlobalVariables collection. Set the Value property, and then Add the object to the collection.

Alternatively, you can create and add the GlobalVariable object to the GlobalVariables collection with the AddGlobalVariable method.

You need to create GlobalVariable objects before package execution if the ExplicitGlobalVariables property of the Package2 object is set to TRUE. However, if ExplicitGlobalVariables is set to FALSE, you do not need to create GlobalVariable objects. The package automatically creates global variables that do not exist at first reference.

Setting global variables with the ExecuteSQLTask2 object
You can create and assign values to global variables in the ExecuteSQLTask2 object. Specify a list of global variable names with the OutputGlobalVariableNames property. Values from the first row of the rowset generated by the ExecuteSQLTask2 query (specified with the SQLStatement property) are stored in the named global variables. Set the OutputAsRecordset property to store the entire rowset as a disconnected Microsoft® ActiveX® Data Objects (ADO) recordset in the global variable named first in the list.

Using global variables as input parameters
You can use global variables as input parameters for the queries of the DataDrivenQueryTask2, DataPumpTask2, ExecuteSQLTask2 and ParallelDataPumpTask objects. Specify a list of global variable names with the InputGlobalVariableNames property. For more information, see Adding DTS Query Strings.

Exporting global variables to a DTS package
Create and add global variables, as described above, to the GlobalVariables collection of the ExecutePackageTask object to export these global variables to the target package. These global variables are independent of the global variables in the GlobalVariables collection of the calling package. Use the InputGlobalVariableNames property of ExecutePackageTask to specify global variables from the collection of the package that are to be exported.

Referencing global variables in ActiveX scripts
Reference global variables in ActiveX scripts as members of the DTSGlobalVariables collection. For example, in Microsoft Visual Basic® Scripting Edition (VBScript):

DTSGlobalVariables( "GV1" ).Value

If you assign a value to the above expression and GV1 does not exist, and if the package ExplicitGlobalVariables property is not set, GV1 is created.

For more information about the GlobalVariable object and the GlobalVariables collection, see DTS Global Variables in Visual Basic.
__________________
"El hombre, en su orgullo, creó a Dios a su imagen y semejanza."
Friedrich Nietzsche
  #5 (permalink)  
Antiguo 22/07/2005, 14:48
Avatar de acervantes  
Fecha de Ingreso: agosto-2003
Ubicación: Madrid
Mensajes: 311
Antigüedad: 20 años, 8 meses
Puntos: 1
he probado así y no pasa nada en updates o otros queries...
debe de haber alguna forma...
__________________
ACervantes

[El éxito dura hasta que alguien las caga; los errores son eternos]
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 16:49.