Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Missing end comment mark "*/" error on SQL Server 2008, not on 2005

A script that had run without a problem on SQL Server 2005 now throws an error on SQL Server 2008:

Missing end comment mark '*/'.

Here's the script

/********************************************************************************************************
Script: ED demographic update_new.sql
Author: ADR
Purpose: Uses tbl_patient_history in PHD to update patient demographics at time of attendance. Supersedes
         ED demographic update_old.sql, which relied on the data warehouse.
*********************************************************************************************************/

USE DB1

EXEC pr_printdate 'ED Demographic Update Start'

/*
DROP TABLE temp_ae_demo_update

CREATE TABLE [dbo].[temp_ae_demo_update](
    [aed_attendance_id] [varchar](20) NOT NULL,
    [ae_arr_date] [datetime] NOT NULL,
    [patient_id] [varchar](20) NULL,
    [patient_trust_number] [varchar](20) NULL,
    [birth_date] [datetime] NULL,
    [marital_status] [varchar](5) NULL,
    [ethnic_code] [varchar](5) NULL,
    [sex] int NULL,
    [nhs_number] [varchar](20) NULL,
    [patient_forename] [varchar](100) NULL,
    [patient_surname] [varchar](100) NULL,
    [patient_add_1] [varchar](100) NULL,
    [patient_add_2] [varchar](100) NULL,
    [patient_add_3] [varchar](100) NULL,
    [patient_add_4] [varchar](100) NULL,
    [patient_postcode] [varchar](20) NULL,
    [regd_gp_code] [varchar](10) NULL,
    [regd_practice_code] [varchar](10) NULL,
    [gp_postcode] [varchar](10) NULL,
    [demo_updated] [int] NOT NULL
)
*/

etc etc... this is the only portion of the script containing comments and the error occurs in this section. Errors reported:

Msg 113, Level 15, State 1, Server UBHNT126, Line 4
Missing end comment mark '*/'.

Msg 102, Level 15, State 1, Server UBHNT126, Line 24
Incorrect syntax near '*'.

There are no go statements in the header block - which I'd usually look for in this situation do any other statements other than "GO" cause the same error?

This doesn't happen on 2005, only 2008. I'm not too worried about this specific case, as I can just remove the comment, but we're porting an entire system over to 2008 and I'd like to have a fix in hand for other cases where this could recur.

ALSO - this only occurs when I call the script on the server (from a cmdexec in a job) not if I run the script in ssms (whether 2008 or 2005)

Stored proc create statement :

    USE [PHD]
GO

/****** Object:  StoredProcedure [dbo].[pr_printdate]    Script Date: 04/04/2013 13:24:14 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO



ALTER procedure [dbo].[pr_printdate] @printext char(30) as
set nocount on
select '**** ' + rtrim(@printext) + ' **** timestamp: ' + convert(char(20), getdate())
set nocount off

GO

COmmand to call script:

osql /e /n /S SERVER /U xxxxx /P xxxxx /d PHD /i "\\SERVER\phdadmin\SQL\AE Monthly\ED_Demographic_update_new.sql" /o "\\SERVER\PHDAdmin\LOG\ED_Demographic_update_new.log"
like image 556
DanBennett Avatar asked Dec 20 '22 07:12

DanBennett


1 Answers

I encountered similar problem in SQL 2012. I had GO statement before end comment */. Removing the GO statement within the comment before */ resolved the issue.

like image 102
ancoder Avatar answered Dec 22 '22 20:12

ancoder