3

Is it possible to create a database/DDL trigger in C#? And, if so, then how?

[EDIT]

Basically, I decided to use CLR for the database trigger because I want to utilize C# SMO to script the objects that change and insert the object script into a table that tracks versions of database objects.

AdamL
  • 12,421
  • 5
  • 50
  • 74
bitcycle
  • 7,632
  • 16
  • 70
  • 121
  • 1
    Triggers can use functions & stored procedures, so I don't see why a SQLCLR function/SP couldn't be used in a trigger (assuming SQL Server 2005+). The real question is *why* do you feel the need to do this? – OMG Ponies Oct 21 '10 at 18:31

2 Answers2

1

See: Programming CLR Triggers

Joe Stefanelli
  • 132,803
  • 19
  • 237
  • 235
0

Or See: CLR Triggers Continue toward the bottom for DDL example.

JeffO
  • 7,957
  • 3
  • 44
  • 53