Cómo hago un trigger en mysql
Hola, tengo instalado PHP y MySql en Win2000, todo anda más que bárbaro, pero quiero hacer un trigger para tomar los datos de un archivo y procesarlos pero no se como hacerlo y no encontré nada en la net.
La idea es que este trigger cada 1 hora levante los datos del archivo y los cargue en una tabla.
Si alguien tiene una punta se lo agradeceré.
Slds
Lutian_de_Martian
La idea es que este trigger cada 1 hora levante los datos del archivo y los cargue en una tabla.
Si alguien tiene una punta se lo agradeceré.
Slds
Lutian_de_Martian
mira lo que yo hice es exportar los datos a un archivo de texto plano y despues importarlo atraves de phpmyadmin
otra cosa yo tengo windows 2000 pro me gustaria saber si temgo que activar el iis para poder instalar correctamente php y mysql
otra cosa yo tengo windows 2000 pro me gustaria saber si temgo que activar el iis para poder instalar correctamente php y mysql
Espero te pueda servir este ejemplo:
create trigger trg_iu_titles
on titles
for insert, update
as
if exists (select * from inserted
where type not in ("business", "mod_cook", "popular_comp",
"psychology", "trad_cook", "UNDECIDED"))
begin
raiserror 30031 "The modification has been aborted because the given type is not a valid type."
rollback trigger
return
end
else if exists (select * from inserted
where (type = "business" and title_id not like "BU%") or
(type = "mod_cook" and title_id not like "MC%") or
(type = "popular_comp" and title_id not like "PC%") or
(type = "psychology" and title_id not like "PS%") or
(type = "trad_cook" and title_id not like "TC%") or
(type = "UNDECIDED" and title_id is not NULL))
begin
raiserror 30032 "The modification has been aborted because at least one title ID does not match its type."
rollback trigger
return
end
return
go
create trigger trg_iu_titles
on titles
for insert, update
as
if exists (select * from inserted
where type not in ("business", "mod_cook", "popular_comp",
"psychology", "trad_cook", "UNDECIDED"))
begin
raiserror 30031 "The modification has been aborted because the given type is not a valid type."
rollback trigger
return
end
else if exists (select * from inserted
where (type = "business" and title_id not like "BU%") or
(type = "mod_cook" and title_id not like "MC%") or
(type = "popular_comp" and title_id not like "PC%") or
(type = "psychology" and title_id not like "PS%") or
(type = "trad_cook" and title_id not like "TC%") or
(type = "UNDECIDED" and title_id is not NULL))
begin
raiserror 30032 "The modification has been aborted because at least one title ID does not match its type."
rollback trigger
return
end
return
go
