on 09-27-2013 9:44 PM
Buenas tardes
Solicito su apoyo en lo siguiente:
He creado un procedimiento almacenado en SQL que posteriormente ejecuto en el Query Manager y funciona muy bien, sin embargo, deseo que se puedan solicitar dos parámetros para filtrar por un rango de fechas con el campo T0.DocDate pero no tengo idea de como hacerlo
Agradeceré su ayuda
Saludos cordiales
Marco
Buenas noches Marco.
Prueba algo así
declare @d1 date, @d2 date
set @d1=(/*select top 1 T0.DocDate from [dbo].[OINV] T0 where T0.DocDate=*/'[%0]')
set @d2=(/*select top 1 T0.DocDate from [dbo].[OINV] T0 where T0.DocDate=*/'[%1]')
exec TU_Procedimiento @d1,@d2
Saludos
FLR
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hola Marco,
mira creo que debiese ser algo así:
CREATE PROCEDURE [dbo].[SBO_SP_EJEMPLO]
@FECHA1 AS DATE,
@FECHA2 AS DATE
AS
BEGIN
y luego en la query que tienes reemplazar las variables en el where, así:
Where t0.docdate between @fecha1 and @fecha2
espero te ayude!
Saludos!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
104 | |
12 | |
11 | |
6 | |
6 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.