Equivalent of XP_CMDSHELL in AzureDB

北城以北 提交于 2021-01-05 11:58:54

问题


I'm using SQL Server as a service on a MS Azure VM and I would like to use xp_cmdshell in a stored procedure but I get the below error/information message:

The module 'ProcExportFacturaEDI_Manual2' depends on the missing object 'xp_cmdshell'. The module will still be created; however, it cannot run successfully until the object exists.

I read online and find out that in MS Azure is not working. Does anyone know what's the equivalent of it or how can I use it in Azure?

EDIT

I did install it, but I get the below message and the file that should be exported, is not there:

(1 row(s) affected) Msg 2812, Level 16, State 62, Line 119 Could not find stored procedure 'xp_cmdshell'.


回答1:


Azure SQLDB does not support xp_cmdshell. Full stop. There is no "equivalent" because Azure SQLDB runs in a shared environment without access to the host unlike the standalone, full access to the host environment you're used to with your on-premises instances.

You will need to rewrite your stored procedure to not use it. We cannot tell you what the "equivalent" would be because we do not have access to your stored procedure, nor do we know the requirements.

If you cannot avoid using xp_cmdshell, then Azure SQLDB may not be for you. You'll want to look at setting up a VM running SQL Server on Azure (IaaS).




回答2:


SQL Azure does not provide access to a command prompt. Think of SQL Azure as just a virtualized service, without host infrastructure (Virtualized or physical).

If the stored procedure you mentioned needs to create a file, you can create an Azure Function to create a file to an Azure BLOB Storage account instead.

Alternatively, you can find xp_cmdshell available on Azure SQL Server VM (IaaS).



来源:https://stackoverflow.com/questions/50836220/equivalent-of-xp-cmdshell-in-azuredb

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!