Ver Mensaje Individual
  #5 (permalink)  
Antiguo 13/04/2015, 11:45
jmendezg
 
Fecha de Ingreso: febrero-2015
Mensajes: 89
Antigüedad: 9 años, 3 meses
Puntos: 1
Respuesta: Problema con ejecucion de proc almacenado.

Cita:
Iniciado por Libras Ver Mensaje
podrias poner el codigo que esta antes de esa ejecucion y el que esta despues, hay que saber exactamente en que parte esta el error......

Claro,

En resumen lo que esta antes es... :

Código SQL:
Ver original
  1. INSERT INTO [192.168.20.255].DB_.dbo.Agr_GestionUsuarios
  2.                              ( Id_Mes, Id_LineaNegocio, Id_Cartera, Id_Gestor,codigo_llamada, Id_GrupoHora,Id_Tipo_Estado,Id_estadoGestion,Id_SubEstado,codigo_ficha,id_estaripley, id_subestaprose,
  3.                             fecha_gestion,fecha_carga,flag_mejor_gestion,cant_clientes,cant_llamadas,cant_ventas,cant_ventas_val,monto, tiempo_hablado, tiempo_mejorllamada)
  4.                             SELECT Id_Mes, Id_LineaNegocio, Id_Cartera, Id_Gestor,codigo_llamada, Id_GrupoHora,Id_Tipo_Estado,Id_estadoGestion,Id_SubEstado,codigo_ficha,id_estaripley, id_subestaprose,
  5.                             fecha_gestion,fecha_carga,flag_mejor_gestion,cant_clientes,cant_llamadas,cant_ventas,cant_ventas_val,monto,tiempo_hablado, tiempo_hablado_llamada FROM UsuariosUnicos_Stage  
  6.  
  7.  
  8.  
  9.         UPDATE A SET A.Id_Estadogestion=T.Id_Estadogestion
  10.             FROM UsuariosUnicos_Stage A
  11.                 INNER JOIN [192.168.20.255].DB_.dbo.Lk_Estadogestion T ON(T.Cod_Estadogestion=A.codigo_final   )
  12.                 AND t.Id_Lineanegocio = 26
  13.        
  14.             UPDATE A SET A.Id_Subestado=T.Id_Subestado
  15.             FROM  UsuariosUnicos_Stage A  
  16.                 INNER JOIN [192.168.20.255].DB_.dbo.Lk_Subestado T ON(T.Cod_Subestado=A.codigo_final_cross  AND T.id_Estadogestion = A.Id_EstadoGestion)


Luego viene esto que genera error :
Código SQL:
Ver original
  1. UPDATE T SET existe=1
  2.             FROM UsuariosUnicos_Stage  T
  3.                 INNER JOIN
  4.                 (SELECT Id_Cartera, Id_Gestor, Fecha_Gestion
  5.                 FROM [192.168.20.255].DB_.dbo.Agr_GestionUsuarios
  6.                 GROUP BY Id_Cartera, Id_Gestor, Fecha_Gestion
  7.                 ) AS B ON T.Id_Cartera=B.Id_Cartera AND T.Id_Gestor = B.Id_Gestor AND T.Fecha_Gestion = B.Fecha_Gestion


Lo que viene esta comentado, (lo hice para detectar donde cae).
Esto:

Código SQL:
Ver original
  1. UPDATE T SET  T.Fecha_carga = B.fecha_carga, cant_clientes = B.cant_clientes, cant_llamadas = B.cant_llamadas, cant_ventas =B.cant_ventas, cant_ventas_val = B.cant_ventas_val ,
  2.                     monto = B.monto
  3.                      FROM [192.168.20.255].DB_.dbo.Agr_GestionUsuarios  T
  4.                         INNER JOIN
  5.                             (SELECT Id_Cartera, Id_Gestor,Fecha_Gestion,fecha_carga, cant_clientes,cant_llamadas, cant_ventas, cant_ventas_val,monto, tiempo_hablado
  6.                             FROM UsuariosUnicos_Stage  H
  7.                             WHERE existe = 1
  8.                             ) AS B ON  T.Id_Cartera=B.Id_Cartera AND T.Id_Gestor = B.Id_Gestor AND T.fecha_Gestion =B.fecha_Gestion


Y otras cosas más..

Cabe resaltar que todo eso funcionaba.. tal y como lo muestro... Como dije es extraño antes :/