Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

View tables in the database that have triggers

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

In this project, in order to synchronize the database, we use the trigger mechanism. When migrating the database, we need to obtain those tables in the database that use triggers to facilitate the production of database installation packages.

Idea:

The trigger is managed as an object in MSSQL, so we can query it through the sysobjects table.

So we wrote a trigger to get the SQL.

SELECTobject_name (a.parent_obj) as [Table], a.name as [trigger], (case when b.is_disabled=0 then'in use 'else' disable 'end) as [trigger status], b.create_date as [write date], b.modify_date as [Last modified date] C.text as [trigger content] FROM sysobjects aINNER JOIN sys.triggers bON b.object_id=a.idINNER JOIN syscomments cON c.id=a.idWHERE a.xtypetriggered trigger tr'-- tr stands for type trigger ORDER BY [table]

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report