0
我需要定期从下面的链接下载数据并将其保存到MS数据库中。我使用WebClient类创建了CLR函数,但everythig在一行中,我需要将它分开。在CLR函数中返回数组
我想到了将数据保存在数组中,使用split并在循环中返回它,但我不知道如何逐行返回以将其保存在数据库中。
public partial class UserDefinedFunctions
{
private static readonly WebClient webClient = new WebClient();
[Microsoft.SqlServer.Server.SqlFunction]
public static SqlString DownloadSynop(string uri)
{
string synop = webClient.DownloadString(uri);
string[] lines = synop.Split(new string[] { Environment.NewLine, "\n", "\"r" }, StringSplitOptions.None);
for (int i=0; i<lines.Length - 1; i++)
{
string kod = lines[i];
}
return new SqlString(kod); //problem
}
}