简体   繁体   English

在 Azure Synapse Datawarehouse 中查找与存储过程相关的所有表

[英]Find All the tables related to a stored procedure in Azure Synapse Datawarehouse

Is there a simple way to find out all the tables referenced in a stored procedure in azure analytics data warehouse other than parsing the stored procedure code? azure分析数据仓库中的存储过程中引用的所有表,除了解析存储过程代码外,有没有简单的方法? I tried few commands like sp_tables , sp_depends but none seems to be working in azure data warehouse.我尝试了一些命令,如sp_tablessp_depends但似乎没有一个在 azure 数据仓库中工作。

sys.sql_expression_dependencies is supported in Azure Synapse Analytics, dedicated SQL pools, but only supports tables, views and functions at this time. Azure Synapse Analytics 支持 sys.sql_expression_dependencies,专用 SQL 池,但目前仅支持表、视图和函数。 A simple example:一个简单的例子:

SELECT * FROM sys.sql_expression_dependencies;

So you are left either parsing sys.sql_modules .所以你要么解析sys.sql_modules Something like this is imperfect (ie doesn't deal with schema name, square brackets, partial matches etc) but could server as a starting point:这样的事情是不完美的(即不处理模式名称、方括号、部分匹配等)但可以作为起点:

SELECT 
    sm.[definition],
    OBJECT_SCHEMA_NAME(t.object_id) schemaName,
    OBJECT_NAME(t.object_id) tableName
FROM sys.sql_modules sm
    CROSS JOIN sys.tables t
WHERE sm.object_id = OBJECT_ID('dbo.usp_test')
  AND sm.[definition] Like '%' + t.name + '%';

I actually use SQL Server Data Tools (SSDT) with dedicated SQL pools so your dependencies can't get out of step and are trackable via the project.实际上,我将 SQL 服务器数据工具 (SSDT) 与专用的 SQL 池一起使用,这样您的依赖项就不会失调,并且可以通过项目进行跟踪。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Azure Synapse 出现问题:管道无法执行在 Develop 脚本中运行的存储过程 - Trouble with Azure Synapse: pipeline cannot execute a stored procedure that works in Develop script Azure 突触等效命令 - Azure synapse equivalent commands Azure 突触分析 Json 展平 - Azure Synapse Analytics Json Flatten 如何在 Azure Synapse 中找到 HASH DISTRIBUTION 中使用的列? - How do I find the column used in a HASH DISTRIBUTION within Azure Synapse? 增加存储过程中的 azure Data Explorer 查询限制 - Increase azure data explorer query limit inside stored procedure 需要在 Redshift 中查找依赖存储过程列表 - Need to find dependent stored procedure list in Redshift Azure Synapste 预测 Model 与 Synapse ML 预测 - Azure Synapste Predict Model with Synapse ML predict Azure Synapse Workspace 加载资源失败 - Azure Synapse Workspace failed to load ressources 我可以在 Azure 环境之外使用 Azure Synapse 功能吗? - Can I use Azure Synapse functionality outside the Azure environment? 是否可以在云数据流谷歌云平台中使用 apache 光束执行存储过程 MySQL Azure? - Is possible to execute Stored Procedure MySQL Azure using apache beam in cloud dataflow google cloud platform?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM