Solved

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

Posted on 2013-01-18
8
567 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
8 Comments
 
LVL 15

Assisted Solution

by:navneethegde
navneethegde earned 334 total points
ID: 38793450
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 75

Assisted Solution

by:käµfm³d 👽
käµfm³d   👽 earned 166 total points
ID: 38794469
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
ID: 38795473
>>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
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 
LVL 5

Author Comment

by:25112
ID: 38795476
>>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
 
LVL 75

Expert Comment

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

Accepted Solution

by:
navneethegde earned 334 total points
ID: 38795629
@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
ID: 38819291
>>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
ID: 38819294
>>
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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

688 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