Solved

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

Posted on 2013-01-18
8
549 Views
Last Modified: 2013-01-30
inside a SQL Server trigger or other t-sql code, is it possible to call a c# code piece/element to execute?
0
Comment
Question by:25112
  • 4
  • 2
  • 2
8 Comments
 
LVL 15

Assisted Solution

by:navneethegde
navneethegde earned 334 total points
Comment Utility
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
 
LVL 74

Assisted Solution

by:käµfm³d 👽
käµfm³d   👽 earned 166 total points
Comment Utility
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
 
LVL 5

Author Comment

by:25112
Comment Utility
>>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
 
LVL 5

Author Comment

by:25112
Comment Utility
>>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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 74

Expert Comment

by:käµfm³d 👽
Comment Utility
What do you mean by "compromise?"
0
 
LVL 15

Accepted Solution

by:
navneethegde earned 334 total points
Comment Utility
@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
 
LVL 5

Author Comment

by:25112
Comment Utility
>>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
 
LVL 5

Author Comment

by:25112
Comment Utility
>>
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

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

SQL Server engine let you use a Windows account or a SQL Server account to connect to a SQL Server instance. This can be configured immediatly during the SQL Server installation or after in the Server Authentication section in the Server properties …
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now