CLR Integration in SQL Server – SQL Server Tutorial

CLR Integration in SQL Server :-

The stored procedures & functions can also be created by using c# (or) VB.
And the objects are called “CLR database objects”
The difference is tsql is “procedure oriented”and c#,VB is “object oriented”.
To create CLR database objects to follow the steps:

  1. create assembly in c# on VB.
  2. create assembly in sql server based on assembly created in c# on VB
  3. create procedure/function based on that assembly.
  4. execute procedure/function.
  • Start a new project in visual studio
  • Expand  database object →(or) visual c# (or) visual basic →  database → sql server project
  • Expand Microsoft sql server
  • Select sql server
  • Select sql server project
  • [in a new project]
  • select project menu
  • Select add stored procedure
  • Under public static void stored procedure
  •   Sql context pipe  send(“hello);
  • Then goto sql server
  • Select database
  • Select programability
  • Select assembly
  • Right click new assembly
  • Click browse→find  where we can store & select the assembly of .net.
  • Assembly name :sql server project2
  • Click →ok.
  • Create a procedure

Create procedure display


External name  sqlserver project 2. stored procedure.

Stored procedure1

(methode name)

Start →program→sql server 2005

Configuration  tools

Sql server surface area configuration

Select surfacearea configuration for features

Select the CLR integration

Check the  CLR      integration.



Sp_configure ‘clr  enabled’,1

after that execute



Exec display

Leave a Reply

Your email address will not be published. Required fields are marked *