>I need to create a trigger for delete and execute an stored procedure to insert in another table how has delete, what form and date.
>
>Who can help me with this.
>
>Is there a way to do it for all the tables in a database?
>
>Thanks in advance.
To specify a procedure to run when a record is deleted in a table, click on the table tab in the table designer (dbc contained tables only), and put the name of the procedure in the delete trigger box: MyDeleteRoutine(). You'll want to create this routine as a dbc stored procedure so it is always available to the table.
As far as specifying who deleted the record, and what form did it, that gets a little trickier. You could put some code put some code in your trigger like:
IF TYPE("_SCREEN.ActiveForm.Name") = "C"
lcFormName = _SCREEN.ActiveForm.Name
ELSE
lcFormName = ""
ENDIF
* grab the user name from the system
lcUserName = SUBSTR(SYS(0), RAT("#", SYS(0)) + 1)
ltDeletedTime = DATETIME()
lcTable = ALIAS()
INSERT INTO DELETELOG (User, Form, Deleted, Table) VALUES (lcUsername, lcFormName, ltDeletedTime, lcTable)
to do this for every table in the database, you would have to specify this procedure in every table.
Erik Moore
Clientelligence