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:
- create assembly in c# on VB.
- create assembly in sql server based on assembly created in c# on VB
- create procedure/function based on that assembly.
- 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
As
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.
↓
Enable.
(or)
Sp_configure ‘clr enabled’,1
↓
after that execute
↓
Reconfigure
↓then
Exec display