遇到错误 "The file specified for :r command was not found"

Getting an Error "The file specified for :r command was not found"

我有以下代码,我正尝试从 SSMS SQL Cmd 模式 运行

:setvar SQLScriptPath "D:\DBScript\"

:r  $(SQLScriptPath)[=11=]1_CreateTables_User.SQL;

:r  $(SQLScriptPath)[=11=]2_CreateTables_SystemSettings.sql;

但是在执行此操作时,出现以下错误

A fatal scripting error occurred. The file specified for :r command was not found.

我试过使用和不使用单引号和双引号,但没有成功。非常感谢任何帮助。

提前致谢

删除 :r 命令的分号。分号用于终止 SQL 命令。 :r 是一个工具 "command",由 sqlcmd.exe/SSMS.

处理