sql-server - 可以从 SQL Server 数据库中的存储过程运行 Linux 脚本吗?
问题描述
我想从存储过程运行 shell 脚本作为一种解决方法,以实现工具默认不提供的功能。
可能吗?数据库是 SQL Server,bash shell
解决方案
是的。查看https://docs.microsoft.com/en-us/sql/relational-databases/system-stored-procedures/xp-cmdshell-transact-sql?view=sql-server-ver15。要使用 xp_cmdshell 您必须激活它,这是通过以下命令完成的:
-- this turns on advanced options and is needed to configure xp_cmdshell
sp_configure 'show advanced options', '1'
RECONFIGURE
-- this enables xp_cmdshell
sp_configure 'xp_cmdshell', '1'
RECONFIGURE
推荐阅读
- php - 如何仅基于月份和年份选择mySQL记录而不进行全表扫描
- c++ - 如何使用模板获取向量中的数据类型?
- nginx - nginx-ingress 为特定路径添加自定义标头
- amazon-s3 - Confluent S3 连接器说明
- java - 无法解析方法 valueof(java.math.BigDecimal)
- reactjs - 无法解构“对象(...)(...)”的属性“currentUser”,因为它为空
- php - PHP:如何检查 PHP 版本?
- terraform-provider-azure - 如何使用 Terraform 将文件从本地计算机复制到存储帐户
- hive - AWS Athena:HIVE_BAD_DATA 错误:parquet 中的字段类型 DOUBLE 与表架构中定义的类型不兼容
- html - 验证码图像未显示在我的 asp.net mvc 应用程序中