Incorrect syntax near '¯' when passing empty file to MSBuild.ExtensionPack.SqlServer.SqlCmd

Nov 28, 2013 at 11:05 AM
I get this SQL Server error when I pass an empty file to MSBuild.ExtensionPack.SqlServer.SqlCmd:

Msg 102, Level 15, State 1, Server .\SQLEXPRESS, Line 1
Incorrect syntax near '¯'.

The file is generated by ( and it looks an encoding issues since it works fine if I open and save the blank file in e.g. Notepad.

Has anyone else encountered this?
Nov 28, 2013 at 6:26 PM
I got sent some sample files. They are UTF08 with a BOM (or some variation thereof). I tried adding -f i:65001 to the parameters to force it to use UTF8 but I get a similar message.

you could try converting the files to another format. Why do you need to execute an empty file?

Marked as answer by macode on 11/28/2013 at 1:11 PM
Nov 28, 2013 at 8:09 PM
Thanks for the quick reply Mike!

I added a check to not run the file if it's empty so my script work fine. This is for a database CI process and the empty file happens when dbDeploy does not detect any changes for a specific instance of the target database and hence outputs an empty delta script.

It's only a slight annoyance and I just wanted to highlight this as others might have similar issues!

Thanks again for confirming why it failed!