SP CONFIGURE 'clr_enabled', 1
sp_configure 'clr enabled', 1;
2)Set database trushworthy:
ALTER DATABASE master SET trustworthy ON
If database is authorized by another user you should run this statement. Dont write your db name or user name with ' '
ALTER AUTHORIZATION ON DATABASE: 'db name' TO 'user name'
ALTER AUTHORIZATION ON DATABASE: 'db name' TO 'DOMAIN/user name'
In some cases you may wonder who is the owner of a database. You can use the following function to learn SID and name:
,SL.Name as [LoginName]
FROM master..sysdatabases SD inner join master..syslogins SL
on SD.SID = SL.SID
Where SD.Name = 'db name'
4)Create Assembly from dll file produced in .NET:
CREATE ASSEMBLY 'file name'
from 'dll path'
WITH PERMISSION_SET = EXTERNAL_ACCESS
5)Create Stored Procedure using the assembly file above.
CREATE PROCEDURE 'procedure name'
EXTERNAL NAME 'assembly name'.'project namespace'.'function name'
Web services may require more than one assembly reference. For instance XML.Serialization is one of the reference that is automatically added to the project when a web service is used. Therefore you may need to consider additional assemblies. Since i do not want to deal with such references, i used httprequest object to consume web service.