I need to download regularly the data from link like below and save it to the MS database. I made CLR function with WebClient class but everythig is in one row, I need to separate it.
I got the idea to save the data in the array, use split and return it in loop but I don't know how to return line by line to save it in database.
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
}
}