我刚回答了这个问题,但从未试过回答。所以我试过了。
SQL command mode SQL SERVER - unable to Print
我想,如果打印成功,命令肯定会运行,但令我惊讶的是,它没有运行
USE [DBName]
:setvar ScriptPath 'C:\Work\'
:setvar SQLFile 'Test.sql'
----- commented PRINT $(ScriptPath) + $(SQLFile) ---- Works
GO
:r $(ScriptPath) + $(SQLFile) --- Doesn't work
-- throws:A fatal scripting error occurred. Incorrect syntax was encountered while parsing :r
:r $(ScriptPath)+$(SQLFile) --- Doesn't work
-- throws:A fatal scripting error occurred. Unable to process :r command
GO
我搜索了一下,但找不到正确的答案。
这里需要修复什么?