1

I downloaded an AdventureWorks 2012 LT Script from CodeProject, but when I try to run it it says:

Incorrect syntax was encountered while parsing :setvar.

There's nothing more than this:

:setvar SqlSamplesDatabasePath   "C:\Program Files\...\DATA\";
:setvar SqlSamplesSourceDataPath "C:\Samples\...\";

And yes, I set the SQLCMD mode on.

Aaron Bertrand
  • 272,866
  • 37
  • 466
  • 490
pangular
  • 699
  • 7
  • 27

1 Answers1

3

Yes, don't put semi-colons at the end of any SQLCMD lines; this is not T-SQL and is subject to different parser / interpreter rules and syntax.

:setvar SqlSamplesDatabasePath   "C:\...\"
:setvar SqlSamplesSourceDataPath "C:\...\"
------------------------------------------^
Aaron Bertrand
  • 272,866
  • 37
  • 466
  • 490
  • 1
    Thanks. I fell foul of this too. Surprisingly, these semicolons are in Microsoft's distribution of AdventureWorks LT 2012 on http://msftdbprodsamples.codeplex.com/ : Well, they got that one wrong, didn't they! – Phil Factor Feb 19 '15 at 15:38