Sql 2000 Script Create Table on from 2005 Management Studio error

  • CREATE TABLE [dbo].[Primes](

    [Prime] [int] NOT NULL,

    CONSTRAINT [PK_Prime] PRIMARY KEY CLUSTERED

    (

    [Prime] ASC

    )WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]

    ) ON [PRIMARY]

    Error Received from 2005 Management Studio

    Msg 170, Level 15, State 1, Line 6

    Line 6: Incorrect syntax near '('.

  • Did you mean to post this in the 2008 forum? If so, I tested your script on a 2008 database and it ran just fine. I'm not sure where the error is coming from.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • Scripting from Sql 2005 Management studio of a Sql 2000 table, and then attempting to execute the code on Sql 2005.

  • I've tested in 2008 and 2005. I also change the compatibility level of the database I was testing on and it worked on all of them, even 7.0. I'm not sure why you're getting the error.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • Pretty weird that you can get it to run, the only way I can is by removing "WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]"

  • That is odd. Did you try taking off only part of it? Remove the parenthesis? Remove the ON [Primary]? Remove one of the WITH clauses?

    I'm just not sure. I've run it on three different machines including a virtual 2008 machine. Maybe you shoulre repost the question in SQL Server 2000 forum?

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • Ok, Thanx! (I didn't realize I was in the 2008 forum, sorry)

  • Also - depending on which one you're in - there's an option in the scripting category to "create scripts with compatibility for SQL2000" or something very closely related to that. In other words - script the objects from within SSMS using SQL2000 compatible syntax. Are you doing that, or have you left the options on the standard settings?

    I'm talking about the stuff under Tools, Options.

    ----------------------------------------------------------------------------------
    Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?

  • I have tested this . No Error.

Viewing 9 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic. Login to reply