开发者

Getting table name in a trigger in MySQL

is it possible t开发者_如何学JAVAo get table name in a MySQL trigger ? i use trigger to log insert actions on some tables in MySQl and i need the name of the table where the trigger is placed at.

Thanx before :)


I would recommend that you put triggers on all the tables that require logging.


Here is an example:

@tablename = OBJECT_NAME(parent_object_id) 
         FROM sys.objects 
         WHERE sys.objects.name = OBJECT_NAME(@@PROCID)**
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜