views:

28

answers:

1

Just recently, SQL 2005 Management Studio started throwing syntax errors while trying to save changes to tables. These are tables being made in Design view, not as TSQL scripts.

'Build_Group' table
- Unable to create index 'PK_Build_Group'.
Incorrect syntax near ','.

Based on the error, it seems that the recreation of the clustered index on the primary key is failing, but this is an entirely automated process by SQL, its own generated TSQL behind the scenes, and the change to the table was not to the key field, ie the clustered index that generated just fine before is now failing.

This install of SQL is more than a year old and I work in it every day with no problem. Nothing has changed to the environment that I know of.

Anyone seen this before ?

== EDIT TO ORIGINAL ==============================

Below is the Generated Change Script

BEGIN TRANSACTION
SET QUOTED_IDENTIFIER ON
SET ARITHABORT ON
SET NUMERIC_ROUNDABORT OFF
SET CONCAT_NULL_YIELDS_NULL ON
SET ANSI_NULLS ON
SET ANSI_PADDING ON
SET ANSI_WARNINGS ON
COMMIT
BEGIN TRANSACTION
GO
ALTER TABLE dbo.Build_Group ADD CONSTRAINT
    PK_Build_Group PRIMARY KEY CLUSTERED 
    (
    build_group_pk
    ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

GO
COMMIT

The syntax error is occurring on the WITH line. If I rem out the two ALLOW options, it will run.

A: 

here is my suggestion:

1) reboot your PC
2) enter SSMS
3) right click the table and select "refresh"
4) open the table, right click and select "Design", and make a change
5) click on the "generate change script" toolbar icon (or from the menu - "Table Designer" then "generate change script")
6) store a copy of this change script
7) attempt to save the table
8) if you still get an error, edit your question to include the change script

KM