SQLCLR is a technology for hosting of the .NET CLR engine inside SQL Server. Adding an assembly can be a lifesaver sometimes, since the limitations of coding in TSQL stored procedures, triggers or functions are a lot and profound.
2. Add the following code
3. After building the assembly, place the dll somewhere that SQL Server can read it and try the following: