Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Server: Msg 170, Level 15, State 1 error

Author  Topic 

Gary A Taylor
Starting Member

1 Post

Posted - 2005-12-12 : 17:46:59
I have a new 2003 server loaded with SQL 2000. I have tried to run the following thru Query Analizer and keep getting the errors at the end. Please note this was written in SQL 7
What is the syntax?
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+
set quoted_identifier off
USE CRSDB4 --Use CARE4 CRSDB Database
GO --Execute Database Pointers
-----------------------------------------------------------------------------------------------
--CRSDB Database = g:\care4\DEVDATA\CRSDB.mdf (0 Minute, 1 Second Runtime)
DROP TABLE REPORT_DET --Purge CRSDB4.DEVDATA (1 SECOND RUNTIME)
GO
-----------------------------------------------------------------------------------------------
CREATE TABLE REPORT_DET --REPORT DETAIL (RPT/RD)
(RPT_SYSCTR char(08) NOT NULL, --CRS390
CPD_PROGRAM char(08) NOT NULL, --CRS390
CTR_CENTER char(08) NULL DEFAULT " ", --CRS025
CSA_USERID char(08) NULL DEFAULT " ", --CRS030
GRP_GROUP char(08) NULL DEFAULT " ", --CRS060
LVA_LIVING char(06) NULL DEFAULT " ", --CRS075
STF_STAFF char(06) NULL DEFAULT " ", --CRS065
CLT_CLIENT char(06) NULL DEFAULT " ", --CRS210
NOD_NEED char(03) NULL DEFAULT " ", --CRS220
NOD_OBJECT char(03) NULL DEFAULT " ", --CRS220
NOD_VERSION char(02) NULL DEFAULT " ", --CRS220
LLM_XREF char(06) NULL DEFAULT " ", --CRS080
RPT_TYPE char(08) NULL DEFAULT " ", --CRS390
RPT_SHOW char(02) NULL DEFAULT " ", --CRS390
RPT_MODE char(02) NULL DEFAULT " ", --CRS390
RPT_FORM char(06) NULL DEFAULT " ", --CRS390
RPT_DATE_FROM char(08) NULL DEFAULT "0", --CRS390
RPT_DATE_TO char(08) NULL DEFAULT "0", --CRS390
RPT_OPTION char(10) NULL DEFAULT " ", --CRS390
RPT_REQMTS1 char(28) NULL DEFAULT " ", --CRS390
RPT_REQMTS2 char(28) NULL DEFAULT " ", --CRS390
RPT_REQMTS3 char(28) NULL DEFAULT " ", --CRS390
RPT_URGENCY char(02) NULL DEFAULT "N", --CRS390
RPT_OUTPRI char(02) NULL DEFAULT "8", --CRS390
RPT_CRS900 char(02) NULL DEFAULT "Y", --CRS010
RPT_PRINT char(02) NULL DEFAULT "Y", --CRS390
RPT_COPY char(02) NULL DEFAULT "1", --CRS390
RPT_PRINTER char(08) NULL DEFAULT "P07001", --CRS030
RPT_BLDG char(06) NULL DEFAULT " ", --CRS030
RPT_DELIVERY char(01) NULL DEFAULT " ", --CRS390
RPT_PHONE char(12) NULL DEFAULT " ", --CRS030
RPT_CREATOR char(08) NULL DEFAULT "CRS390") --CRS390
CREATE CLUSTERED INDEX CC_RPTCPD_IDX ON REPORT_DET (CPD_PROGRAM)
GO --Execute Table &Index Creations
-----------------------------------------------------------------------------------------------
EXEC sp_dboption CRSDB4,"SELECT INTO/BULKCOPY",TRUE --Set T-SQL Options
EXEC sp_tableoption "REPORT_DET", "TABLE LOCK ON BULK LOAD",TRUE
-----------------------------------------------------------------------------------------------
BULK INSERT REPORT_DET
FROM 'D:\CARE4\TXTDATA\REPORT.txt' --System;Report;Center;Group;...
WITH (BATCHSIZE = 5, --Define 7 records per Batch
DATAFILETYPE = 'char', --Ascii Code File
FIELDTERMINATOR = ';', --Each Field is separated with a semi-colon
-- KEEPNULLS, --Show empty fields as Null
ORDER (RPT_SYSCTR ASC), --Sort by: System Center
TABLOCK) --Lock the Table
GO --Execute Database Pointers
-----------------------------------------------------------------------------------------------
ALTER TABLE REPORT_DET --REPORT DETAIL (RPT/RD)
ADD RPT_RECNO int IDENTITY (1,1) NOT NULL --CRS390
CREATE NONCLUSTERED INDEX NC_RPTREC ON REPORT_DET (RPT_RECNO)
GO --Execute Table &Index Creations
---------------------------------------------------------

Server: Msg 170, Level 15, State 1, Line 4
Line 4: Incorrect syntax near 'GO'.
Server: Msg 170, Level 15, State 1, Line 36
Line 36: Incorrect syntax near 'GO'.
Server: Msg 170, Level 15, State 1, Line 49
Line 49: Incorrect syntax near 'GO'.
Server: Msg 170, Level 15, State 1, Line 54
Line 54: Incorrect syntax near 'GO'.

Thanks, Gary

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2005-12-12 : 20:34:42
Hey Gary,
try moving the comments (after 'GO') to another line. ie:
CREATE NONCLUSTERED INDEX NC_RPTREC ON REPORT_DET (RPT_RECNO)
GO
--Execute Table &Index Creations

I don't know why but when I did that i didn't get any more incorrect syntax errors when I checked your code.

Be One with the Optimizer
TG
Go to Top of Page
   

- Advertisement -