Editing a Primary Key

Edit a primary key to change the column or columns whose values uniquely identify a row in a table.

Prerequisites 

Before you can edit a primary key, be sure that the data server is running, you created and established a connection to the data server, and you opened the table that contains the primary key in the Table Schema Editor.

  1. In the Table Schema Editor, select the Constraints tab for the table for which you want to edit the primary key.
  2. Expand the Primary Key folder under Constraints in the directory tree, and highlight the primary key to edit.
  3. Edit the primary key settings in the Details pane.
    Field Description
    Name Enter a name for the primary key in the text field.
    Filter Column by Name Pattern Enter a filter expression for the columns to be displayed in the list of available columns. For example, * lists all columns for the specified table.
    Available Columns Available columns for defining a primary key. You can sort the list of columns by clicking on Column Name above the list. Move a column from the Available Columns list to the Selected Columns list in one of three ways:
    • Double-click the column in the Available Columns list. This specifies that the primary-key index is created in ascending order for this column.
    • Highlight the column, and click ASC>>. This also specifies that the primary-key index is created in ascending order for this column.
    • Highlight the column, and click DESC>>. This specifies that the primary-key index is created in descending order for this column.
    Selected Columns A list of columns selected as defining the primary key. You can sort the list of columns by clicking Column Name above the list. You can also reorder a list item by highlighting the column in the list and clicking Up or Down. To place a column back in the Available Columns list, highlight the column and click <<Remove.
    Fill Factor Choose the fill factor setting, which specifies how full the data server makes each page when it creates a new primary key on existing data. The default is 0.
    Maximum Rows Per Page Specify the maximum number of rows on data pages and the leaf-level pages of indexes. The default is 0.
    Reserve Page Gap Specify the ratio of filled pages to empty pages to be left during I/O allocation operations. For each specified number of pages, an empty page is left for future expansion of the index. Valid values are 0 – 255. The default is 0.
    Create on Segment Specify whether to create the primary key on a default or system segment.
  4. Select File > Save from the main menu in WorkSpace.
  5. (Optional) If a Preview Changes dialog appears with the DDL for altering the primary key, choose the appropriate save option.
    Option Description
    To execute the changes Click Save.
    To save the DDL to a SQL file Click Save As, enter or select a project or project folder, and specify a file name for the DDL.
Related concepts
Primary Keys
Related tasks
Creating a Primary Key
Dropping a Primary Key


Created June 25, 2009. Send feedback on this help topic to Sybase Technical Publications: pubs@sybase.com