views:

30

answers:

2

Is it possible for a SQL Stored Procedure to call a .NET object? In my situation, I need to take a string parameter and return a hashed result that can be consumed by my secure client.

I can either have this SP called on a per result basis (once per row), or I can possibly return multiple rows. It all depends on what SQL will support me doing.

+3  A: 

SQL Server 2005 introduced CLR into the server. This allows you to write .NET functions and call them from within SQL Server stored procedures.

Read this howto on how to create and use CLR within SQL Server.

This will work in SQL Server 2005 and above.

Oded
What happens to the assembly after I deploy it? Where does it go? (is it still needed on the file system?)
MakerOfThings7
@MakerOfThings7 - As far as I know it is held within SQL Server. See [this](http://msdn.microsoft.com/en-us/library/dahcx0ww.aspx)
Oded
+1  A: 

You can write sql stored procedure in C# by using Sql Clr which will allow to call .Net object.

Giorgi