Retroceder   Foros del Web > Programación para sitios web > Bases de Datos > SQL Server

Respuesta
 
Herramientas Desplegado
Antiguo 25-abr-2008, 16:30   #1 (permalink)
alegna_13 ha deshabilitado el karma
 
Fecha de Ingreso: abril-2008
Ubicación: MEXICO D.F.
Mensajes: 11
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 ***
alegna_13 está desconectado   Responder Citando
Antiguo 25-abr-2008, 17:08   #2 (permalink)
flaviovich está en el buen camino
 
Avatar de flaviovich
 
Fecha de Ingreso: agosto-2005
Ubicación: Lima, Peru
Mensajes: 1.148
Enviar un mensaje por ICQ a flaviovich Enviar un mensaje por MSN a flaviovich Enviar un mensaje por Skype™ a flaviovich
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
flaviovich está desconectado   Responder Citando
Respuesta
Calificación: Calificación de Tema: 1 votos, 4,00 de promedio.


Herramientas
Desplegado

Normas de Publicación
No puedes crear nuevos temas
No puedes responder temas
No puedes subir archivos adjuntos
No puedes editar tus mensajes

BB code is Activado
Caritas están Activado
[IMG] está Activado
Código HTML está Desactivado


La Zona horaria es GMT -6. Ahora son las 01:38.


Message Board Statistics

LinkBacks Enabled by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93