Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 804
  • Last Modified:

Executing a .NET dll from SQL Server

I am after examples / advice on how to execute a .Net DLL function from a trigger in Microsoft SQL 2005 and above.

The trigger will call a function and pass in values and a parameter name.

I have seen examples using COM but I am sure there are more up-to-date ways.
0
rocky050371
Asked:
rocky050371
1 Solution
 
Barry CunneyCommented:
Create an assembly that references the .NetDLL
Then create a proc that references this assembly
Then call this proc in the trigger

http://www.sqldbatips.com/showarticle.asp?ID=22
0
 
jamesrhCommented:
You can actually create a .NET SQL Server trigger in 2005 and higher.

Here is a good article about creating native SQL CLR objects.

You can create SPs, Functions, Triggers, Data Types, and custom Aggregates.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
Anthony PerkinsCommented:
I am after examples / advice on how to execute a .Net DLL function from a trigger in Microsoft SQL 2005 and above.
This is a very bad idea. I am sure you will go ahead regardless, so I am going to just have to wish you good luck.
0
 
rocky050371Author Commented:
Why is it a bad idea?
0
 
Anthony PerkinsCommented:
My mistake, I thought you were trying to use a DLL from a T-SQL Trigger.  Using a CLR Trigger is a totally different animal.
0
 
rocky050371Author Commented:
I am, I appreciate the reservations with regards to calling dlls from SQL Server however to achieve the functionality I am after I will need to incorporate it. The user through a series of options will build their trigger script. It will in turn call a dll with the specified change values which will then be picked by an external program.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now