I have the below master script which creates tables, and inserts some data and then creates the stored procedures.
--todo_master.sql
use master
go
:r todo_create_ddl.sql
:r todo_create_dml.sql
:r todo_create_sprocs.sql
go
However, even though the todo_master.sql is in the same path as the other three scripts, it is unable to locate those three scripts.
I get the following error:
A fatal scripting error occurred.
The file specified for :r command was not found.
If I provide the complete path like below, these files are found and executed as intended.
"C:\Docs and Settings\user\My Docs\SSMS\Projects\todo_create_ddl.sql"
What might I be missing?
Edit As suggested by Jason I tried this, but still get the same error:
use master
go
:setvar path "C:\Documents and Settings\user\My Documents\SQL Server Management Studio\Projects"
:setvar ddl "todo_create_ddl.sql"
:setvar dml "todo_create_dml.sql"
:setvar sprocs "todo_create_sprocs.sql"
:r $(path)$(ddl)
:r $(path)$(dml)
:r $(path)$(sprocs)
go