Can we call .DLL from SQL server ?

Post date: Mar 4, 2011 7:29:19 AM

sp_configure 'clr enabled', 1

GO

RECONFIGURE

GO

 

Deploying the Assembly in SQL Server 2008

 

 

create ASSEMBLY Encryption1 from 'c:\boobalan\Encrypt.dll' WITH PERMISSION_SET = SAFE

go

 

 

Create a function using the Assembly file:

 

create function [dbo].[Encrypt](

      @plainText nvarchar(max),

      @passPhrase nvarchar(max),

      )

      returns nvarchar(max)

AS

 

//Creating & executing the CLR stored procedure in SQL Server 2008

 

EXTERNAL NAME Encryption1.DotNetSolution.Encrypt

go

 

Call the Function Using SQL Command 

 

select @value = dbo.Encrypt('muruga','Pass@123')

select @value