Editing Table Schema Data

Edit table schema to change the table definition and control the assigned privileges.

Prerequisites 

Before you can edit table schema data, be sure the data server on which you are editing a table is running, and you created and established a connection to the data server.

Use the Table Schema Editor to:
  • Add and edit columns
  • Create and edit primary and foreign keys
  • Create indexes
  • Add constraints
  • Edit storage properties
  • View database definition language (DDL)
  • View index placement
  • View index fragementation
  • Create defaults
  • Create rules
  • Grant table privileges
  1. In Enterprise Explorer, expand the Tables folder and find the appropriate table.
  2. Right-click the table, a table column, a primary key, or a constraint, and choose Edit.
  3. Edit the table properties.
    Note: If you add or delete an index or a trigger, the operation is executed immediately on the data server. If you edit an index or trigger, or make additions or modifications or to other database objects, those changes are persisted to the data server when you save your changes in the editor.
    Tab Description
    Columns Set column properties for the table.
    • Filter – use simple character matching and wildcards to display a subset of columns, then click Filter. For example, to display all columns that begin with a "c," enter c. To display all columns that begin with "au" and end in an "e," enter au*e.
    • Table Name – specify the name of the table.
    • Primary Key – make the corresponding column part of the primary key for this table.
    • Column Name – specify the column name.
    • Datatype – specify the column datatype.
    • Nullable – enable null values for this column.
    • Default – click ... to specify a default value for this column.
    • Rule Binding – select a rule, if applicable, to restrict data in this column. This is an option for Adaptive Server Enterprise data servers only.
    • Identity – mark this as an IDENTITY column, which is a column that contains system-generated values that uniquely identify each row in a table. This is an option for Adaptive Server Enterprise data servers only.
    • Check Constraint – to define a check constraint for this column, click in the column, and click ... to open the Define Column Check Constraint wizard. This is an option for Adaptive Server Enterprise data servers only.
    • IQ Unique – define the cardinality of the column. This is an option for Sybase IQ data servers only.
    • Computed Column – for computed columns, enter an expression that defines the computation for the column.
    • Comment – enter addtional comments about the column. This is an option for SQL Anywhere and Sybase IQ data servers only.
    Use Add and Delete to change the list of columns for this table.
    Constraints Use Add and Delete to change the primary-key, unique, foreign-key, and check constraints for this table.
    Indexes Use Add, Delete, and Edit to change the indexes defined for this table.
    Trigger (ASE and SQL Anywhere only) Use Add, Delete, and Edit to change the triggers defined for this table.
    Permissions Set permissions for the table. You can specify Granted, Granted with Grant Option, Inherited, and Revoked Inherited Permissions for one or all columns.
    Storage Set storage properties for the table.

    Adaptive Server Enterprise:


    • Segment – specify whether to create the index on a default or system segment.
    • Max Row Per Page – specify the number of rows on data pages. Valid values are 0 – 256. 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.
    • Identity Gap – specify the identity gap, which is the number IDs per block assigned in memory. For example, an identity gap of 10 indicates that ID numbers are allocated in memory in blocks of 10. If the server fails or is shut down with no wait, the maximum gap between the last ID number assigned to a row and the next ID number assigned to a row is 10 numbers of memory blocks assigned for each ID. Enter a value in the corresponding text field. The default is 0.
    • Replacement Strategy – select Most Recently Used to replace items in cache with those that have been most recently used. Select Off to disable this option.
    • Prefetch Strategy – select On to enable prefetching from cache. Select Off to disable this option.
    • Locking Scheme: Specify the locking scheme for the table. Valid values are All Pages, All Rows, and Data Pages.
    • Expected Row Size – if you have selected a locking scheme by data rows, specify the expected size of rows for this table.

    Sybase IQ:


    • Free Size Reserved for Each Table – specify the default (200 bytes) or a percentage.
    DDL View the DDL for the table. The content in this tab is read-only.
  4. Select File > Save from the main WorkSpace menu.
  5. Click Save in the Preview Changes window to execute the SQL code and save the changes to the database.

    The Preview Changes window appears unless the option is unselected through the Schema Object Editor Configuration preference page.

Related tasks
Creating a Database
Creating a Table
Creating a Primary Key
Creating a Foreign Key
Creating a Unique Constraint
Creating a Check Constraint
Creating an Index for a SQL Anywhere Table
Creating an Index for an ASE Table
Creating an Index for a Sybase IQ Table
Creating a Column
Entering Column Default Values
Creating a Default
Creating an ASE Rule
Editing and Viewing Table Storage Properties
Viewing the Database Definition Language for a Table
Related reference
Schema Object Creation Wizard Configuration
Create Index Preferences
Create Table Preferences


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