This is the code that I used to create SQL Function
using System;
using System.Data;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using Microsoft.SqlServer.Server;
using System.Text;
using System.Runtime.InteropServices;
namespace EncodingConversion
{
public partial class test
{
...