![](/img/trans.png)
[英]Is it possible to execute Databricks Notebooks from a SQL Stored Procedure
[英]Is it possible to rewrite sql clr function as sql stored procedure?
我在我的項目中使用 sql clr 程序集和 sql clr 用戶定義函數。 例如:
[SqlFunction]
public static SqlString InsertCampaignRecipients(SqlString url)
{
var rowData = string.Empty;
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
var response = client.GetAsync(new Uri(url.Value)).Result;
if (response.IsSuccessStatusCode)
{
var result = response.Content.ReadAsStringAsync().Result;
if (result.IndexOf(@"""Exception"":null}") > 0) //success
{
rowData = "success";
}
else
{
rowData = string.Empty;
}
}
else
{
rowData = string.Empty;
}
}
return rowData;
}
但是我想在 Azure 上遷移,clr 不支持。 解決辦法是什么? 是否可以將 sql clr function 重寫為 sql 存儲過程之類的?
因此,您想直接從T-SQL發出HTTP請求。 那是不能做的,對不起!
當前 ,Azure SQL數據庫不支持SQLCLR(甚至不支持SAFE
)。 假設您在正確的上下文中使用SQLCLR,而無法在T-SQL中完成某些操作,那么否,Azure SQL數據庫中沒有等效項。 但是,即使Azure SQL數據庫再次支持SQLCLR(從2014年下半年到2016年4月中,它僅進行了超過18個月的支持),但它仍然可能不支持執行外部請求,例如網絡或文件系統。 因此,即使在Azure SQL數據庫允許SQLCLR程序集期間,仍然不支持問題中的Web請求。
這在新的Azure SQL數據庫托管實例上很有可能會起作用,但是我不能肯定地說。
您可以使用 C# SQL 服務器的語言擴展 Microsoft 開源 .NET 5 C# SQL 服務器的語言擴展https://visualstudiomagazine.com/articles/20121/2010
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.