update con validaci贸n de varias tablas en sqlserver 2000
Buenas tardes
El problema que tengo es el siguiente:
Necesito en sql server 2000 hacer un update a una tabla pero para ello requiero que se cumplan varias condiciones que involucran a otras dos tablas, hasta el momento he utilizado los siguientes 3 scripts y ninguno me ha funciona y siempre me genera un error de sintaxis
1.
update grupoinvestigacion
set grupoinvestigacion.Investigador = (select investigador.Nombre
from investigador, grupoinvestigacion, colaboracion
where (investigador.CodInvestigador = colaboracion.CodInvestigador
and grupoinvestigacion.CodGrupo = colaboracion.CodGrupo
and colaboracion.TipoColaboracion = 'Investigador Principal'
and grupoinvestigacion.Investigador LIKE ''))
2.
update grupoinvestigacion,investigador,colaboracion
set grupoinvestigacion.Investigador = investigador.Nombre
where (investigador.CodInvestigador = colaboracion.CodInvestigador
and grupoinvestigacion.CodGrupo = colaboracion.CodGrupo
and colaboracion.TipoColaboracion = 'Investigador Principal'
and grupoinvestigacion.Investigador LIKE '')
3.
update grupoinvestigacion
inner join colaboracion
on (grupoinvestigacion.CodGrupo = colaboracion.CodGrupo AND
grupoinvestigacion.Investigador LIKE '' AND
colaboracion.TipoColaboracion = 'Investigador Principal')
inner join investigador
on investigador.CodInvestigador = colaboracion.CodInvestigador
set grupoinvestigacion.Investigador = investigador.Nombre
lo curioso es que al hacer el equivalente con un select funcionan bien y me seleccionan lo que requiero
agradezco su colaboraci贸n y disculpen si comet铆 alg煤n error infantil
El problema que tengo es el siguiente:
Necesito en sql server 2000 hacer un update a una tabla pero para ello requiero que se cumplan varias condiciones que involucran a otras dos tablas, hasta el momento he utilizado los siguientes 3 scripts y ninguno me ha funciona y siempre me genera un error de sintaxis
1.
update grupoinvestigacion
set grupoinvestigacion.Investigador = (select investigador.Nombre
from investigador, grupoinvestigacion, colaboracion
where (investigador.CodInvestigador = colaboracion.CodInvestigador
and grupoinvestigacion.CodGrupo = colaboracion.CodGrupo
and colaboracion.TipoColaboracion = 'Investigador Principal'
and grupoinvestigacion.Investigador LIKE ''))
2.
update grupoinvestigacion,investigador,colaboracion
set grupoinvestigacion.Investigador = investigador.Nombre
where (investigador.CodInvestigador = colaboracion.CodInvestigador
and grupoinvestigacion.CodGrupo = colaboracion.CodGrupo
and colaboracion.TipoColaboracion = 'Investigador Principal'
and grupoinvestigacion.Investigador LIKE '')
3.
update grupoinvestigacion
inner join colaboracion
on (grupoinvestigacion.CodGrupo = colaboracion.CodGrupo AND
grupoinvestigacion.Investigador LIKE '' AND
colaboracion.TipoColaboracion = 'Investigador Principal')
inner join investigador
on investigador.CodInvestigador = colaboracion.CodInvestigador
set grupoinvestigacion.Investigador = investigador.Nombre
lo curioso es que al hacer el equivalente con un select funcionan bien y me seleccionan lo que requiero
agradezco su colaboraci贸n y disculpen si comet铆 alg煤n error infantil
