Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 Running a SQL Script from a SQL Command Line.

Author  Topic 

mruprai
Starting Member

12 Posts

Posted - 2014-08-20 : 13:57:05
Hi im trying to execute a SQL Script from SQL commandline within management studio.

however get the error .

A fatal scripting error occurred.
Incorrect syntax was encountered while parsing :r .


the following is what I run.(I use % for spaces?)
:setvar path "F:\Centre%of%Credit%Excellence\Development\2.%Prep%Scripts\"
:setvar DataFile "ImportScript_EDIT.sql"

any ideas?

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2014-08-20 : 14:20:56
When I am in sqlcmd mode and check the syntax of what you posted, it checks fine.

I would switch the % to spaces though as the double quotes handle the paths/file names that have spaces.

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page
   

- Advertisement -