Reputation: 219
I have a SQl
file generated using a batch command . The batch just collates all SQl
files under a directory to a single file for deployment. Individual pieces work fine in the deployment file but it gives an error that says "Incorrect syntax near ''.".
It is because of the comments section in the file, but I fail to understand what causes the error in the comments section
The code snippet is below.
/*
-----------------------------------------------------------------------
<copyright file="tblMPI_Configuration.sql" company="">
</copyright>
-----------------------------------------------------------------------
Author:
Modification Log:
$Id: tblMPI_Configuration.sql 22746 2013-06-19 13:20:46Z xxxxxxx $
Description:
This table holds the MPI Config Information
*/
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'U' AND name = 'MPI_Configuration')
BEGIN
DROP Table MPI_Configuration
END
GO
CREATE TABLE [dbo].[MPI_Configuration](
[ID] [int] IDENTITY(1,1) NOT NULL,
[SourceType] [varchar](3) NULL,
[Item] [varchar](50) NOT NULL,
[Value] [varchar](50) NULL,
CONSTRAINT [PK_MPI_Configuration] PRIMARY KEY CLUSTERED
(
[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/*
-----------------------------------------------------------------------
<copyright file="tblMPI_LKUP_MatchingStatus.sql" company="">
</copyright>
-----------------------------------------------------------------------
Author:
Modification Log:
$Id: tblMPI_LKUP_MatchingStatus.sql 22746 2013-06-19 13:20:46Z xxxxxxx $
Description:
This table holds the MPI matching status
*/
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'U' AND name = 'MPI_LKUP_MatchingStatus')
BEGIN
DROP Table MPI_LKUP_MatchingStatus
END
GO
CREATE TABLE [dbo].[MPI_LKUP_MatchingStatus](
[MPI_StatusCode] [int] NOT NULL,
[MPI_StatusMessage] [varchar](100) NULL,
CONSTRAINT [PK_MPI_LKUP_MatchingStatus] PRIMARY KEY CLUSTERED
(
[MPI_StatusCode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
Upvotes: 0
Views: 194
Reputation: 38645
How is your batch file merging these files? There is a <feff>
before the second comment. http://en.wikipedia.org/wiki/Byte_order_mark.
<feff>/* <--------------------------------------------------------- Here
-----------------------------------------------------------------------
<copyright file="tblMPI_LKUP_MatchingStatus.sql" company="">
</copyright>
-----------------------------------------------------------------------
Author:
Modification Log:
$Id: tblMPI_LKUP_MatchingStatus.sql 22746 2013-06-19 13:20:46Z xxxxxxx $
Description:
This table holds the MPI matching status
*/
And here is what Google showed me: http://connect.microsoft.com/SQLServer/feedback/details/789853/sql-text-containing-a-byte-order-mark-fails-to-execute.
Also have a look at this link for possible fixes: http://social.msdn.microsoft.com/Forums/en-US/01185066-a387-4c49-8087-e472182935ef/urgetnt-byte-order-mark-error-error-reading-data-from-sql-server-using-custom-pipeline
Upvotes: 1