Improve company productivity with a Business Account.Sign Up

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

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?
0
25112
Asked:
25112
  • 4
  • 2
  • 2
3 Solutions
 
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
 
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
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
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
 
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
 
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.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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.

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