Similar issue seen here.
I am trying to run the following command from SSMS running in SQLCMD mode.
:r C:\dev\test scripts\sample.sql
But I get the following error:
A fatal scripting error occurred.
Incorrect syntax was encountered while parsing :r .
I have checked the file, the line endings are appropriate for the Windows machine, and the batch separator matches the settings. What else can I try to run this?
1 Answer 1
I was able to resolve this by changing the file name so that it does not include a space:
:r C:\dev\test-scripts\sample.sql
-
5Rather than change the file name, you can enclose the path in double-quotes:
:r "C:\dev\test scripts\sample.sql"
Dan Guzman– Dan Guzman2023年10月03日 10:43:01 +00:00Commented Oct 3, 2023 at 10:43
lang-sql