I have created a batch script to copy SQL files from a folder into one big SQL script. The problem is when I run this one SQL script it comes up with the error
Incorrect syntax near ''
I copied the one SQL script into Notepad++ and set the encoding to ANSI. I see this symbol  (BOM) on the lines where the error is happening.
Is there anyway I can automatically remove this within my batch script. I don't want to keep manually remove this every time I run this task.
Below is the batch script I have currently
@echo off
set "path2work=C:\StoredProcedures"
cd /d "%path2work%"
echo. > C:\FinalScript\AllScripts.sql
for %%a in (*.sql) do (
echo. >>"C:\FinalScript\AllScripts.sql"
echo GO >>"C:\FinalScript\AllScripts.sql"
type "%%a">>"C:\FinalScript\AllScripts.sql"
echo. >>"C:\FinalScript\AllScripts.sql"
)
