Creation of Tables on a 2000 DB in 2005

  • Hey just thought I'd hit down with some info..

    <CODE>

    USE

    [theDatabase]

    GO

    /****** Object: Table [dbo].[tableAdd] Script Date: 05/10/2007 16:34:46 ******/

    SET

    ANSI_NULLS ON

    GO

    SET

    QUOTED_IDENTIFIER ON

    GO

    SET

    ANSI_PADDING ON

    GO

    CREATE

    TABLE [dbo].[tableAdd](

    [primID] [int]

    IDENTITY(1,1) NOT NULL,

    [secField] [varchar]

    (255) NULL,

    [thirdField] [varchar]

    (255) NULL,

    CONSTRAINT [PK_tableAdd] PRIMARY KEY CLUSTERED

    (

    [primID]

    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

    </CODE>

    (*Remove Code tags!*)

    It errors something like Incorrect syntax near '('.

    This script was created by SQL SERVER 2005 viewing a SQL SERVER 2000 tree database (i.e. db was created in SQL 2000).

    Red text = Erroring text with a Server 2000 database

    Solution: Remove all text in red. It looks like it's added whether it works? I still have to test but looks like it should work!

     

  • Tim,

    the reason why the script fails on a 2000 server is that the options IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON are not known in that version. In management studio when you generate scripts by using the Tasks>Generate Scripts on the second page of the wizard you can set all kind of options. If you scroll down a bit you will see one option called "Script for Server Version" and the default is SQL 2005. Change it to 2000 and your should be fine.

    Markus

    [font="Verdana"]Markus Bohse[/font]

Viewing 2 posts - 1 through 1 (of 1 total)

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