December 5, 2005 at 6:51 am
Hi
im working on SQL2000
and im trying to create a maintenance trigger that will simulate the profiler.
the idea is that whenever - any user - does a DML action on the table ( insert , delete , update )- the trigger will insert an info row in a special table created just for maintenance .
the maintenance table has these columns:
tableName: name of table dml action was prefomed on
user: name of user that preformed action.
action: insert,delete,update
date: time DML action was preformed
Row: the syntax of the DML
i have some problems....
im planing in using a cursor on the inserted/deleted tables
but i dont know all the commnands to get the info i need.
biggest problem - how do i transform the inserted/deleted row i get from the cursor - into a string to put in the Row Column ???
im totally open for suggestions 🙂
or if some one has ths trigger already done - id love to get the code
thx
December 5, 2005 at 7:59 am
search BOL for inserted tables
Str or convert or cast function can change the datatype
information_schema.columns can give u the list of columns in a table
SELECT user_name() will give u the username
December 5, 2005 at 11:09 am
you would build the cursor on the inserted table and loop through it.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply