Foros del Web » Programación para mayores de 30 ;) » Bases de Datos General » SQL Server »

Problemas Con Convert !!! Ayuda Porfavor

Estas en el tema de Problemas Con Convert !!! Ayuda Porfavor en el foro de SQL Server en Foros del Web. HOLA A TODOS ESPERO QUE ALGUIEN PUEDA AYUDAR A RESOLVER UNA DUDA CON CONVERT; POR QUE ME SALE UN ERROR Y LA VERDAD NO TENGO ...
  #1 (permalink)  
Antiguo 25/04/2008, 16:30
 
Fecha de Ingreso: abril-2008
Ubicación: MEXICO D.F.
Mensajes: 22
Antigüedad: 16 años
Puntos: 0
Exclamación Problemas Con Convert !!! Ayuda Porfavor

HOLA A TODOS ESPERO QUE ALGUIEN PUEDA AYUDAR A RESOLVER UNA DUDA CON CONVERT; POR QUE ME SALE UN ERROR Y LA VERDAD NO TENGO IDEA DE COMO RESOLVERLO POR QUE NO HABÍA MANEJADO EL CONVERT.

BUENO EL ERROR ES ESTE :
-------------------------------------------------------------------------------------->>

(0 filas afectadas)


(0 filas afectadas)


(1 filas afectadas)

Servidor: mensaje 242, nivel 16, estado 3, procedimiento sp_ResumenServiciosProgramados_mod, línea 176
La conversión del tipo de datos char a datetime produjo un valor datetime fuera de intervalo.

(0 filas afectadas)

------------------------------------------------------------------------------------>>

Y las lineas de codigo donde me marca el error son estas :

BEGIN

Select count(*) as TotalProgramados,IDServicio,Servicio,IDSubservicio ,Subservicio,
convert(varchar(2),datepart(mm,Fecha))+ '/'+ convert(varchar(2),datepart(dd,Fecha))+ '/'+ convert(varchar(4),datepart(yyyy,Fecha))Fecha,
IDSoporteServicio
from TempResumenProgramados
where UsuarioActivo=@UsuarioActivo
and Fecha >= convert(varchar(2),datepart(mm,@FechaHoy))+ '/'+ convert(varchar(2),datepart(dd,@FechaHoy))+ '/'+ convert(varchar(4),datepart(yyyy,@FechaHoy))
group by IDServicio,Servicio,IDSubservicio,SubServicio,Fech a,IDSoporteServicio
order by IDServicio,Servicio,IDSubservicio,SubServicio,Fech a,IDSoporteServicio
END

------------------------------------------------------------------------------------------>>


Espero que alguien me pueda ayudar de antemano GRACIAS !!!
ALEGNA ***
  #2 (permalink)  
Antiguo 25/04/2008, 17:08
Avatar de flaviovich  
Fecha de Ingreso: agosto-2005
Ubicación: Lima, Peru
Mensajes: 2.951
Antigüedad: 18 años, 8 meses
Puntos: 39
Re: Problemas Con Convert !!! Ayuda Porfavor

Código:
DECLARE @FechaHoy SMALLDATETIME
SET @FechaHoy = '25/04/2008'
SELECT convert(varchar(2),datepart(mm,@FechaHoy))+ '/'+ convert(varchar(2),datepart(dd,@FechaHoy))+ '/'+ convert(varchar(4),datepart(yyyy,@FechaHoy))
SELECT CONVERT(VARCHAR(10),@FechaHoy,101)
No seria mejor la segunda forma?
__________________
No repitamos temas, usemos el Motor de busquedas
Plantea bien tu problema: Ayúdanos a ayudarte.
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta

SíEste tema le ha gustado a 1 personas




La zona horaria es GMT -6. Ahora son las 20:30.