Ver Mensaje Individual
  #6 (permalink)  
Antiguo 06/09/2007, 07:39
Avatar de Andres95
Andres95
Colaborador
 
Fecha de Ingreso: diciembre-2004
Mensajes: 1.802
Antigüedad: 19 años, 5 meses
Puntos: 38
Re: Consulta con Right outher

Ok iislas, he realizado la prueba pero no veo la diferencia, por favor indicame que es lo que estoy omitiendo.

Te comento,

El query utilizado es el siguiente:

Código:
Set nocount on 

if object_id('tempdb..#tmpTemporal') is not null drop table #tmpTemporal

create table #tmpTemporal(iValue int Identity(1,1) Primary Key, dValue datetime)

Declare @IniDate as datetime, @EndDate datetime

Set @IniDate = getdate()
Set @EndDate = dateadd(mm,6,@IniDate)

print @IniDate
print @EndDate


while @IniDate <= @EndDate
Begin
   Insert into #tmpTemporal values(@IniDate)

   Set @IniDate = dateadd(hh,1,@IniDate)

End

Declare @pIniDate as datetime, @pEndDate as datetime

Select  @pIniDate = '20070901', @pEndDate = '20070925'
Select * from  #tmpTemporal where dValue between @pIniDate and @pEndDate
Select * from  #tmpTemporal where dValue >= @pIniDate and dValue <= @pEndDate
Y el plan de ejecucion me arroja exactamente los mismos numeros para ambas sentencias.

Adicionalmente observo que en la parte de arguments el SQL ha traducido el between en la sentencia equivalente con los operadores >= y <=

¿será por eso que no hay diferencias en los numeros?.




---


Saludos
__________________
La sencillez y naturalidad son el supremo y último fin de la cultura...
--
MCTS : SQL Server 2008, .NET Framework 3.5, ASP.NET Applications.

Última edición por Andres95; 06/09/2007 a las 07:45