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 the Databases folder in Enterprise Explorer, under the database connection profile, expand the navigation tree for the appropriate database and schema owner.
    Database Steps
    From an ASE connection profile
    1. Expand the Databases folder.
    2. Expand the tree for a database and then the tree for the appropriate schema owner.
    From a SQL Anywhere or Sybase IQ connection profile
    1. Expand the tree for a database.
    2. Expand the Schemas folder and then the tree for the appropriate schema owner.
  2. Expand the Tables folder and find the appropriate table.
  3. Right-click the table, and choose Edit.
  4. 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.
    Editor Tab Description
    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 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.

    For an ASE table:


    • 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.

    For a Sybase IQ table:


    • Free Size Reserved for Each Table – specify the default (200 bytes) or a percentage.
    Placement View the index placement for the table. The content in this tab is read-only.
    Fragmentation View the index fragementation for the table. The content in this tab is read-only.
    DDL View the DDL for the table. The content in this tab is read-only.
    Columns Set column properties for the table:
    • 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.
  5. Select File > Save from the main WorkSpace menu.
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

For product-related issues, contact Sybase Technical Support at 1-800-8SYBASE. Send your feedback on this help topic directly to Sybase Technical Publications: pubs@sybase.com