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
}
}