简体   繁体   English

从SQL运行批处理文件

[英]Run batch file from SQL

I want to run batch file from SQL Job without using exec xp_cmdshell. 我想从SQL Job运行批处理文件而不使用exec xp_cmdshell。

Any idea? 任何想法?

Thanks 谢谢

You could use a SQL Server Job, otherwise i cannot think of a way you could without xp_cmdshell. 您可以使用SQL Server作业,否则我无法想到没有xp_cmdshell的方法。
Take a look at this 看看这个

I want to run batch file from SQL Job without using exec xp_cmdshell. 我想从SQL Job运行批处理文件而不使用exec xp_cmdshell。 Any idea? 任何想法?

Worth to mention that you can also leverage SQLCLR . 值得一提的是,您还可以利用SQLCLR

Example: CLR Stored procedure to execute command 示例: CLR存储过程以执行命令

Some other googlable threads: 其他一些可搜索的线程:

Such approach introduces severe risks like memory leaks, crashing of underlying .net app pool etc 这种方法会带来严重的风险,例如内存泄漏,底层.net应用程序池崩溃等。

Therefore another link: Security in the CLR World Inside SQL Server 因此是另一个链接: SQL Server内部的CLR世界中的安全性

Instead of running batch file, i have created power shell and ran it from SQL job. 我没有运行批处理文件,而是创建了Power Shell并从SQL作业中运行了它。 It satisfy my requirement and resolved my issue. 它满足了我的要求并解决了我的问题。

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

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