Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Triggers - C# program

Author  Topic 

csecharith
Starting Member

21 Posts

Posted - 2007-10-12 : 00:38:12
Hi,

In SQL Server is it possible to have a trigger that will throw an event which could be caught by C# program running in the back ground?

Is this even possible? If it is, have u any links to help/examples?

Regards!

jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2007-10-12 : 01:02:23
anything is possible with software, particularly now that in 2005 you could write a CLR trigger.

however i'd be careful about this sort of thing. triggers should be fast and have very limited scope, otherwise the perf of your app will plummet. inter-process communication with a CLR trigger sounds like a great way to force your app to take frequent naps.



elsasoft.org
Go to Top of Page

csecharith
Starting Member

21 Posts

Posted - 2007-10-12 : 04:55:32
I couldn't find any good example in C# do you have any?
Thanks!

quote:
Originally posted by jezemine

anything is possible with software, particularly now that in 2005 you could write a CLR trigger.

however i'd be careful about this sort of thing. triggers should be fast and have very limited scope, otherwise the perf of your app will plummet. inter-process communication with a CLR trigger sounds like a great way to force your app to take frequent naps.



elsasoft.org

Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-10-12 : 05:05:29
i think that all you want is a raiserror statement with high enough severity in your trigger.
that will return the error back t your c# app and terminate the connection.

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
SSMS Add-in that does a few things: www.ssmstoolspack.com
Go to Top of Page

jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2007-10-12 : 11:32:07
as I understand the OP, this C# app they mention is not the one calling the db. Rather it's just running in the background like a service or something, and they want to signal it from the trigger.

EDIT: fixed grammar. so sloppy!


elsasoft.org
Go to Top of Page
   

- Advertisement -