I'm trying to implement a Common Language Runtime (CLR) assembly to use with SQL Server. For creating dll I'm using Visual Studio 2019.
I have the following code from an example tutorial:
using System;
using System.Collections;
using System.Text;
using System.Data;
using System.Data.SqlTypes;
using Microsoft.SqlServer.Server;
namespace Split
{
public class Class1
{
[SqlFunction(
DataAccess = DataAccessKind.None,
FillRowMethodName = "MyFillRowMethod"
, IsDeterministic = true)
]
public static IEnumerable Split(string stringToSplit, string delimiters)
{
string[] elements = stringToSplit.Split(delimiters.ToCharArray());
return elements;
}
public static void MyFillRowMethod(Object theItem, out SqlChars results)
{
results = new SqlChars(theItem.ToString());
}
}
}
But I encounter this error:
Error CS0234 The type or namespace name 'SqlServer' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
Can anybody show me the way of fixing my problem?