sql-server - 通过批处理文件连接到 SQL Server 时出现问题?
问题描述
我有一个文件夹,我在其中生成了大约 100 个 .sql 文件,以对数据库中的各种模式进行表更改。
我正在尝试使用这篇文章中的方法来运行我的 100 个 sql 文件,但我不断收到错误消息。它适用于前几个文件,然后我开始
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Named Pipes Provider: Could not open a connection to SQL Server [53]. .
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Login timeout expired.
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online..
我知道它配置为远程连接,另一个 VM 上的另一个应用程序使用它,我也检查了服务器属性。前 5-6 个 SQL 文件确实运行,但随后停止,我开始遇到此问题。关于导致它的原因以及如何减轻它的任何想法?我只是想一次做太多事情吗?
更新:我的批处理文件中的代码
for %%G in (*.sql) do sqlcmd /S ServerName /d MyDatabase -U MyUser -P "MyPassword" -i"%%G"
解决方案
推荐阅读
- puppeteer - 使用黄瓜 BDD 框架执行 Puppeteer 时出错
- powershell - 如何使用 Powershell 共享 OneDrive 文件?
- git - 将 repo 从一台计算机复制到另一台计算机后,Git 显示更改和新文件
- r - 在 R/factoextra 中,关于“fviz_cluster”的问题
- c# - 使用 LINQ 获取两个比较列表的结果并根据结果更改列表中的属性
- vscode-calva - Calva 无法启动 betterthantomorrow.calva-2.0.214\clojure-lsp.exe_backup.exe
- r - R 中的 mutate() 函数产生的值不同于直接计算相同输入的值
- flutter - OpenWeather Onecall API
- vaadin - Vaadin 14:可滚动的内容区域
- javascript - 处理multer中的错误?