Ver Mensaje Individual
  #6  
Antiguo 19-05-2011
abelg abelg is offline
Miembro
 
Registrado: jul 2004
Posts: 50
Reputación: 20
abelg Va por buen camino
Hola espero esto te sirva ejecutalo en el manejador de consultas de SQL Server en cualquier base de Datos pues crea temporales.

Código SQL [-]
Create Table #tmp_folio (
        plaza char(2),
        tipo int,
        numtram int,
        inicio int,
        final int,
        numaprobacion int)
        
        
insert into #tmp_folio Values ('01', 3, 1 , 1, 10, 380)
insert into #tmp_folio Values ('01', 4, 1 , 11, 20, 885)

declare @valor_buscado int
-- Ejemplo 1
set @valor_buscado = 3
Select numaprobacion
from #tmp_folio
where plaza = '01' and @valor_buscado between inicio and final 

--Ejemplo2
set @valor_buscado = 15
Select numaprobacion
from #tmp_folio
where plaza = '01' and @valor_buscado between inicio and final 

Drop table #tmp_folio

A mi me salio lo que pedías.
salu2
Responder Con Cita