Showing posts with label pk_segments. Show all posts
Showing posts with label pk_segments. Show all posts

Wednesday, March 21, 2012

Parse error

Can anyone tel lme why this does not parse in 2000 but works fine in 2005?

ALTER TABLE Segments ADD CONSTRAINT

PK_Segments PRIMARY KEY CLUSTERED

(

SegmentsUniqueID

) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON,

ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

thanks.

The WITH clause for constraints is new to SQL Server 2005. You can set some of the options in SQL2000 using sp_indexoption or create index.|||Thanks

Parse error

Can anyone tel lme why this does not parse in 2000 but works fine in 2005?

ALTER TABLE Segments ADD CONSTRAINT

PK_Segments PRIMARY KEY CLUSTERED

(

SegmentsUniqueID

) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON,

ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

thanks

The WITH options cannot be set like this in SQL Server 2000. The ALLOW_ROW_LOCKS and ALLOW_PAGE_LOCKS options for example cannot be used like this, you need the sp_indexoption for that (however these are on by default).