The identifier made up of several parts could not be linked

0

I have the following view on sql server:

create view v_ConsultarReclamo as
select Reclamo.rec_IDReclamo, Reclamo.rec_numero, Reclamo.rec_fechaAlta, AreaServicio.arServ_nombre, TipoReclamo.tipRec_nombre, 
Calle.cal_nombre, Reclamo.rec_altura, Barrio.bar_nombre, EstadoReclamo.estRec_nombre
from Reclamo
inner join Ticket on Reclamo.rec_IDTicket = Ticket.tic_IDTicket
inner join Persona on Ticket.tic_IDPersona = Persona.per_IDPersona
inner join TipoReclamo on TipoReclamo.tipRec_IDTipoReclamo = Reclamo.rec_IDTipoReclamo
inner join AreaServicio on AreaServicio.arServ_IDAreaServicio = TipoReclamo.tipRec_IDAreaServicio
inner join Prioridad on Prioridad.pri_IDPrioridad = TipoReclamo.tipRec_IDPrioridad
inner join CallePorBarrio on CallePorBarrio.calBar_IDCallePorBarrio = Reclamo.rec_IDCallePorBarrio
inner join Calle on Calle.cal_IDCalle = CallePorBarrio.calBar_IDCalle
inner join Barrio on Barrio.bar_IDBarrio = CallePorBarrio.calBar_IDBarrio
inner join EstadoReclamo on EstadoReclamo.estRec_IDEstadoReclamo = Reclamo.rec_IDEstadoReclamo
inner join Usuario on Usuario.usu_IDUsuario = Ticket.tic_IDUsuario

When I want to pass a filter, for example:

select * from v_ConsultarReclamo where Reclamo.rec_IDReclamo = 4

I get the following error:

  

The identifier consisting of several parts "Claim.rec_ID Claim" could not be linked.

How do I solve this? because I tested the filter in my practice and it works perfectly:

select Reclamo.rec_IDReclamo, Reclamo.rec_numero, Reclamo.rec_fechaAlta, AreaServicio.arServ_nombre, TipoReclamo.tipRec_nombre, 
Calle.cal_nombre, Reclamo.rec_altura, Barrio.bar_nombre, EstadoReclamo.estRec_nombre
from Reclamo
inner join Ticket on Reclamo.rec_IDTicket = Ticket.tic_IDTicket
inner join Persona on Ticket.tic_IDPersona = Persona.per_IDPersona
inner join TipoReclamo on TipoReclamo.tipRec_IDTipoReclamo = Reclamo.rec_IDTipoReclamo
inner join AreaServicio on AreaServicio.arServ_IDAreaServicio = TipoReclamo.tipRec_IDAreaServicio
inner join Prioridad on Prioridad.pri_IDPrioridad = TipoReclamo.tipRec_IDPrioridad
inner join CallePorBarrio on CallePorBarrio.calBar_IDCallePorBarrio = Reclamo.rec_IDCallePorBarrio
inner join Calle on Calle.cal_IDCalle = CallePorBarrio.calBar_IDCalle
inner join Barrio on Barrio.bar_IDBarrio = CallePorBarrio.calBar_IDBarrio
inner join EstadoReclamo on EstadoReclamo.estRec_IDEstadoReclamo = Reclamo.rec_IDEstadoReclamo
inner join Usuario on Usuario.usu_IDUsuario = Ticket.tic_IDUsuario
where Reclamo.rec_numero = 4

  

Finally what I did was replace:

where Reclamo.rec_IDReclamo = 4 per where rec_IDReclamo = 4 .

Now it works correctly.

    
asked by Agu Fortini 18.09.2018 в 18:02
source

0 answers