title: Missing end comment mark "*/" error on SQL Server 2008, not on 2005
body: <p>A script that had run without a problem on SQL Server 2005 now throws an error on SQL Server 2008:</p>
  
  <blockquote>
    <p>Missing end comment mark '*/'.</p>
  </blockquote>
  
  <p>Here's the script</p>
  
  <pre><code>/********************************************************************************************************
  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
  )
  */
  </code></pre>
  
  <p>etc etc... this is the only portion of the script containing comments and the error occurs in this section. Errors reported:</p>
  
  <blockquote>
    <p>Msg 113, Level 15, State 1, Server UBHNT126, Line 4<br>
    Missing end comment mark '*/'.</p>
    
    <p>Msg 102, Level 15, State 1, Server UBHNT126, Line 24<br>
    Incorrect syntax near '*'.</p>
  </blockquote>
  
  <p>There are no <code>go</code> 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?</p>
  
  <p>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.</p>
  
  <p>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)</p>
  
  <p>Stored proc create statement :</p>
  
  <pre><code>    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
  </code></pre>
  
  <p>COmmand to call script:</p>
  
  <pre><code>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"
  </code></pre>