SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 Running a SQL Script from a SQL Command Line.
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

mruprai
Starting Member

9 Posts

Posted - 08/20/2014 :  13:57:05  Show Profile  Reply with Quote
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

USA
37157 Posts

Posted - 08/20/2014 :  14:20:56  Show Profile  Visit tkizer's Homepage  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000