Problems creating partitioning on an exsisting table

  • Hi,

    I am trying to create a partition on an existing table and I am struggling

    The only way I can think of doing this is to create a blank table the same as the original but created as a partitioned table. Then copy all the data from the old table to the partitioned table.

    I have had a few hopefully basic problems.

    1)When Scripting the table it has this constraint in the create table

    CONSTRAINT [CPK_MINE] PRIMARY KEY NONCLUSTERED(

    [My_Col] ASC

    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = ON, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [PRIMARY]

    I get this error

    Msg 2714, Level 16, State 4, Line 1

    There is already an object named ' CPK_MINE’ in the database.

    QUESTION 1 How do i create this constraint on my blank partitioned table?

    2)Tables have an IDNETY row how do I insert the date and keep the orginal identy values?

    Many thanks

  • Edward-445599 (11/10/2010)


    Hi,

    I am trying to create a partition on an existing table and I am struggling

    The only way I can think of doing this is to create a blank table the same as the original but created as a partitioned table. Then copy all the data from the old table to the partitioned table.

    I have had a few hopefully basic problems.

    1)When Scripting the table it has this constraint in the create table

    CONSTRAINT [CPK_MINE] PRIMARY KEY NONCLUSTERED(

    [My_Col] ASC

    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = ON, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [PRIMARY]

    I get this error

    Msg 2714, Level 16, State 4, Line 1

    There is already an object named ' CPK_MINE’ in the database.

    QUESTION 1 How do i create this constraint on my blank partitioned table?

    2)Tables have an IDNETY row how do I insert the date and keep the orginal identy values?

    Many thanks

    Rename 'CPK_MINE' with anything else 'CPK_MINE1' will work.

    For question 2, im Assuming you mean Identity Column. So dont add any contraints here. it will copy whatever is in your source. (which is what you want)

    Add an additional column and set the default to Getdate() --(If I am understanding your request correctly to insert the date)

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

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