TSQL script with variables
Posted: Mon 27 Feb 2012 22:19
Hi;
i inherit a sql script that declares two date variables to work, how can i pass those variables to the script from Delphi?
Tried parambyname but doesnt work...
This is part of the script...
i inherit a sql script that declares two date variables to work, how can i pass those variables to the script from Delphi?
Tried parambyname but doesnt work...
This is part of the script...
Code: Select all
DECLARE
@fecha_ini datetime,
@fecha_fin datetime
SELECT @fecha_ini = '2012-02-13', @fecha_fin = '2012-02-13'
DM.Query2.ParamByName('fecha_ini').AsDateTime := Efecha1.DateTime;
DM.Query2.ParamByName('fecha_fin').AsDateTime := Efecha2.DateTime;
SELECT DISTINCT
/*1*/ 'Codigo de Institucion' = 'STER',
/*2*/ 'Codigo de Transaccion' = RTRIM (op.nm_operacion) + '-' + RTRIM (il.nm_liquidacion),
/*3*/ 'Fecha de Transaccion' = CONVERT(VARCHAR(10), op.fecha_operacion, 101),
/*4*/ 'Fecha valor de Transaccion' = CONVERT(VARCHAR(10), op.fecha_valor, 101),
/*5*/ 'Código de Moneda' = CASE op.nm_divisa_operada