简体   繁体   English

xp_cmdshell bcp 的替代品?

[英]alternative to xp_cmdshell bcp?

Is there an alternative to xp_cmdshell BCP to write to a file from MSSQL?是否有 xp_cmdshell BCP 的替代方法可以从 MSSQL 写入文件?

Some context: This is to be built into a stored procedure called by an external program.一些上下文:这将被构建到由外部程序调用的存储过程中。 I do not have the luxury to work through executable files, export functions of ssms, or any such things which require more than the calling of this stored procedure.我没有精力去处理可执行文件、ssms 的导出功能,或者任何需要比调用这个存储过程更多的东西。

The reason;原因; there's a lot of odd stuff on this server to do with user rights, and I'm not the SA.这台服务器上有很多奇怪的东西与用户权限有关,我不是 SA。 I cannot create the ##xp_cmdshell_proxy_account## (let alone assign credentials to it), and xp_cmdshell 'whoami' returns a user noone has ever seen or heard from.我无法创建 ##xp_cmdshell_proxy_account##(更不用说为其分配凭据),并且 xp_cmdshell 'whoami' 返回一个从未见过或听过的用户。 I've tried creating a new user based on an existing windows user and granting xp_cmdshell execute rights to it, but this still did nothing.我已经尝试根据现有的 windows 用户创建一个新用户并授予它 xp_cmdshell 执行权限,但这仍然没有任何作用。 I'm not sure if I don't have the rights or if it's something else.我不确定是我没有权利还是其他原因。

So long story short, I'm fed up with trying to get this to work on this environment and am looking for an alternative.长话短说,我厌倦了试图让它在这种环境下工作,并正在寻找替代方案。 Is there one?有吗?

Write a SQL Agent Job and kick it off with sp_start_job .编写 SQL 代理作业并使用sp_start_job启动它。 You can control the identity the job uses with a SQL Agent Proxy .您可以使用SQL Agent Proxy控制作业使用的身份。

Or write an SSIS package, deploy it to the SSIS Catalog and run it from your stored procedure .或者编写一个 SSIS package,将其部署到 SSIS 目录并从您的存储过程中运行它

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM