Comparacion
Publicado por Juan Luis (2 intervenciones) el 22/02/2008 20:33:02
Saludos
Tego la siguiente situacion :
Dentro de mi tabla actividad tengo un campo FechaActividad es de tipo datetime, mi problema radica que mediante un query quiero que me traiga todos aquellos registros que tengan la fecha del dia , para ello utilizo getdate()
Si hago lo siguiente
Select *from actividad where fechaactividad = Getdate() "No me devuelve nada , y revisando la base si hay registros con la fecha actual"
Y si hago esto otro
Select *from actividad where fechaactividad <= Getdate()
Select *from actividad where fechaactividad >= Getdate()
"Para ambos casos si me devuelve un resultado "
Intente hacer esto
Select *from actividad where fechaactividad > Getdate() and fechaactividad < Getdate() "Pero tampoco me devuelve un resultado "
Tambien intente esto
DECLARE @TODAY DATETIME;
SET @TODAY = GETDATE();
SELECT *FROM ACTIVIDAD
WHERE FechaActividad = @TODAY or
FechaActividad LIKE @TODAY;
"Pero tampoco me devuelve un resultado" Podria alguien ayudarme
Tego la siguiente situacion :
Dentro de mi tabla actividad tengo un campo FechaActividad es de tipo datetime, mi problema radica que mediante un query quiero que me traiga todos aquellos registros que tengan la fecha del dia , para ello utilizo getdate()
Si hago lo siguiente
Select *from actividad where fechaactividad = Getdate() "No me devuelve nada , y revisando la base si hay registros con la fecha actual"
Y si hago esto otro
Select *from actividad where fechaactividad <= Getdate()
Select *from actividad where fechaactividad >= Getdate()
"Para ambos casos si me devuelve un resultado "
Intente hacer esto
Select *from actividad where fechaactividad > Getdate() and fechaactividad < Getdate() "Pero tampoco me devuelve un resultado "
Tambien intente esto
DECLARE @TODAY DATETIME;
SET @TODAY = GETDATE();
SELECT *FROM ACTIVIDAD
WHERE FechaActividad = @TODAY or
FechaActividad LIKE @TODAY;
"Pero tampoco me devuelve un resultado" Podria alguien ayudarme
Valora esta pregunta


0