call c# elements from t-sql (SQL Server) code?

inside a SQL Server trigger or other t-sql code, is it possible to call a c# code piece/element to execute?
LVL 5
25112Asked:
Who is Participating?
 
NavneetSoftware EngineerCommented:
@25112
Microsoft SQL Server is a relational database management system developed by Microsoft. As a database, it is just a software product whose primary function is to store and retrieve data as requested by other software applications,

So it's better leave it to that.

You can think of Solution like
1. Using Notification Server of SQL Server you can write to file on server.
2. Create windows service to read this file and call you C# code within Windows service.

Thanks!
0
 
NavneetSoftware EngineerCommented:
Hi!

No (AFAIK), since compiling of C# wont happen insdie SQl Server.

Your better bet would be to create windows service and read datachanges in table and call your required C# function.

Thanks!
0
 
käµfm³d 👽Commented:
If you enable CLR Integration, then you can execute .NET code within SQL Server. But you have to deploy the code to the server in order to do so. Have a look at:

http://msdn.microsoft.com/en-us/library/ms345136(v=sql.90).aspx
http://msdn.microsoft.com/en-us/library/ms254498(v=vs.80).aspx
http://msdn.microsoft.com/en-us/library/ms131048.aspx
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
25112Author Commented:
>>Your better bet would be to create windows service and read datachanges in table and call your required C# function.

is that the service broker feature in sql server?
0
 
25112Author Commented:
>>But you have to deploy the code to the server in order to do so.

does that compromise a dedicated sql-server only server?
0
 
käµfm³d 👽Commented:
What do you mean by "compromise?"
0
 
25112Author Commented:
>>What do you mean by "compromise?"

sorry for the delay in getting back to you.

by dedicated sql server, i meant that only sql server would exist and most of the memory dedicated to it.. so we wouldn't put too much of other apps/tools on it.
(web server/app server/db server all separated.. that is what i meant by the word compromise)

when you said "you have to deploy the code to the server in order to do so. " i was wondering if you mean to put .net code on the database server.
0
 
25112Author Commented:
>>
1. Using Notification Server of SQL Server you can write to file on server.
2. Create windows service to read this file and call you C# code within Windows service.
<<
can you please give a link for the above 2 to explore these options.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.