• Viernes 26 de Abril de 2024, 12:17

Autor Tema:  Consulta Sobre Triggers  (Leído 1964 veces)

yaG

  • Miembro activo
  • **
  • Mensajes: 46
    • Ver Perfil
Consulta Sobre Triggers
« en: Martes 17 de Julio de 2007, 16:50 »
0
Tengo el siguiente trigger, lo que hace ejecutar un stored procedure pasandole como unico parametro el id_hotel_reserva del registro recientemente insertado.
Dicho stored lo que hace es controlar un par de datos y en caso de error updatearlos, por eso el trigger es para cuando el registro ya esta insertado.

Si pongo esto

CREATE TRIGGER t_depura_hotel ON hotel_reserva_back
FOR INSERT
AS
begin
    execute sp_depura_hotel new.id_hotel_reserva
end

o esto

CREATE TRIGGER t_depura_hotel ON hotel_reserva_back
FOR INSERT
AS
begin
    execute sp_depura_hotel inserted.id_hotel_reserva
end

me tira el siguiente error:
Could not execute statement. Incorrect Syntax near '.'

En cambio si hago esto

CREATE TRIGGER t_depura_hotel ON hotel_reserva_back
FOR INSERT
AS
begin
    execute sp_depura_hotel id_hotel_reserva
end

me tira:
Could not execute statement. Cannot add rows to sysdepends for the current stored procedure because its depends on the missing object 'sp_depura_hotel'. The stored procedure will still be created.

No tengo mucha experiencia con triggers, si alguno tienne alguna punta para tirarme le agredacería mucho.

Saludos!
[size=109]Antes de preguntar recuerda el concepto GIYF. Google is your friend.[/size][/u]