2

I am trying to execute this query but getting syntax error when it perfectly fines with SQL server 2005 and table is already there and am trying to create new table on a different server,

USE [myDataBase]
GO

CREATE TABLE [dbo].[myTable]
(
    [ID] [int] IDENTITY(1,1) NOT NULL,
    [Tittle] [varchar](1024) NOT NULL,
    [Description] [varchar](8000) NOT NULL,
    [Table2ID] [int] NOT NULL,
    [Table3ID] [int] NOT NULL,
 CONSTRAINT [PK_myTable] PRIMARY KEY CLUSTERED 
(
    [ID] ASC
)



WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON, FILLFACTOR = 80) ON [PRIMARY]
) ON [PRIMARY]

GO

Error

Msg 170, Level 15, State 1, Line 16 Line 16: Incorrect syntax near '('.

In above example, Line 16 is empty and am so confused.

5
  • I have not worked on 2000 so I don't know the difference. But just remove Schema before Table name i.e. change [dbo].[myTable] to [myTable] Commented Jun 19, 2013 at 10:54
  • Try not to pay too much attention to the line numbers given to you. its not like VS 2010 where it will pinpoint the exact line, think of them as more a general guide lol Commented Jun 19, 2013 at 11:05
  • @DevN00B If running the query in SSMS then double clicking on the error message should generally take you to the offending line though. It is the 16th line in the batch (18th overall) Commented Jun 19, 2013 at 11:08
  • @RJ1990 that is wrong. Commented Jul 3, 2013 at 17:43
  • Related: stackoverflow.com/questions/1539549/… Commented Jul 3, 2013 at 17:50

1 Answer 1

5

WITH in SQL Server 2000 allows only FillFactor to be set. See the documentation:

http://msdn.microsoft.com/en-us/library/aa258255%28v=sql.80%29.aspx

Remove other options from the WITH clause.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.