January 18, 2008 at 7:01 am
This is a really weird one and im sure someone must have come across it. When you script a table with a primary key using Management Studio the script it generates fails with a syntax error on the bracket around the primary key constraint.
Msg 170, Level 15, State 1, Line 35
Line 35: Incorrect syntax near '('.
The whole script its giving me is as follows...
USE [ADV]
GO
/****** Object: Table [dbo].[cblbrkr1] Script Date: 01/18/2008 13:55:43 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[cblbrkr1](
[brkr1_code] [varchar](6) NOT NULL,
[brkr1_locn_code] [varchar](3) NOT NULL,
[brkr1_locn_name] [varchar](30) NULL,
[brkr1_comp_name] [varchar](30) NULL,
[brkr1_comp_addr1] [varchar](30) NULL,
[brkr1_comp_addr2] [varchar](30) NULL,
[brkr1_comp_addr3] [varchar](30) NULL,
[brkr1_comp_addr4] [varchar](30) NULL,
[brkr1_comp_postcode] [varchar](8) NULL,
[brkr1_comp_phone] [varchar](12) NULL,
[brkr1_fax] [varchar](15) NULL,
[brkr1_dx_num] [varchar](15) NULL,
[brkr1_dx_ex] [varchar](20) NULL,
[brkr1_comp_email] [varchar](64) NULL,
[brkr1_type] [varchar](1) NULL,
[brkr1_alpha_sort] [varchar](10) NULL,
[brkr1_process_type] [varchar](1) NULL,
[brkr1_dps] [datetime] NULL,
[brkr1_ccl_recv] [varchar](1) NULL,
[brkr1_date_ccl_recv] [datetime] NULL,
[brkr1_cmpn_type] [varchar](6) NULL,
[brkr1_sub_type] [varchar](2) NULL,
[brkr1_ccl_number] [varchar](10) NULL,
[brkr1_hml_source] [varchar](5) NULL,
[brkr1_fsa_number] [int] NULL,
[brkr1_fsa_office] [int] NULL,
[brkr1_spare] [varchar](83) NULL,
[rowid] [uniqueidentifier] ROWGUIDCOL NULL,
[fieldID] [int] IDENTITY(1,1) NOT FOR REPLICATION NOT NULL,
CONSTRAINT [PK__cblbrkr1__219706ED] PRIMARY KEY CLUSTERED
(
[brkr1_code] ASC,
[brkr1_locn_code] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
CONSTRAINT [UQ__cblbrkr1__228B2B26] UNIQUE NONCLUSTERED
(
[rowid] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
Anyone any idea why the script feature fails?
January 18, 2008 at 7:34 am
i think it's because the script was generated in compatibility 90 syntax, but you are creating the table in V80:
i think this part is not 80 compatible on line 35 and 39:
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
i tested it, and that's exactly the problem i found.
Lowell
January 18, 2008 at 7:45 am
Doh, you are right!
The compatability was 80 when it should have been 90!
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply