Invoking C++ Code (or DLL) via Trigger

Is it possible to have a trigger invoke code in a running application (either via a register-notify type of thing or by calling entry points of a DLL or…)?

I don’t want the application to have to poll the database. I’d rather have code in the database “poke” the app.

If you’re using C++, you can create extended stored procedures and call them from inside SQL Server. These are stored procedures that are encapsulated in a DLL. Check out the xp_hello extended stored procedure sample that comes with SQL Server.

Once you create the DLL, the stored procedures must be registered in SQL Server (SQL Server BOL has more on the details). Extended stored procedures run in the same address space as SQL Server, so be sure to test them before using them in production.

If you have a Visual Basic or other COM component (DLL), you can call its methods and access its properties using the OLE Automation stored procedures. Using sp_OACreate, sp_OAMethod, and sp_OADestroy, you can create instances of an object and then set and retrieve its properties, as well as call its methods. You can pass parameters into the methods and retrieve values from them.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin


The Latest

chrome os developer mode

How to Turn on Chrome OS Developer Mode

Google’s Chrome OS is a popular operating system that is widely used on Chromebooks and other devices. While it is designed to be simple and user-friendly, there are times when users may want to access additional features and functionality. One way to do this is by turning on Chrome OS

homes in the real estate industry

Exploring the Latest Tech Trends Impacting the Real Estate Industry

The real estate industry is changing thanks to the newest technological advancements. These new developments — from blockchain and AI to virtual reality and 3D printing — are poised to change how we buy and sell homes. Real estate brokers, buyers, sellers, wholesale real estate professionals, fix and flippers, and beyond may

man on floor with data

DevX Quick Guide to Data Ingestion

One of the biggest trends of the 21st century is the massive surge in internet usage. With major innovations such as smart technology, social media, and online shopping sites, the internet has become an essential part of everyday life for a large portion of the population. Due to this internet