Search code examples
sqlsql-serversql-server-2008ssmssqlcmd

The file specified for :r command was not found


In MS SQL Server Management Studio in SQLCMD Mode I use this script to run another script:

:setvar path "C:\workspace\scripts\scripts\"

:r $(path)'VERSIONS.sql'

But it gets this error:

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

VERSIONS.SQL is definitely in the specified folder. Why is this script not working when I run it?

EDIT: Something to note. The database I'm running this script against is not on my local machine. (I hope that's not the reason this isn't working)


Solution

  • I just solved my own problem. I changed the single quotes around VERSIONS.sql to double quotes and it worked.

    Why are they not interchangeable?