Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 10.0.1 » SQL Anywhere Server - SQL Reference » Views » Consolidated views

SYSCOLUMNS consolidated view Next Page

SYSFOREIGNKEYS consolidated view


Each row in the SYSFOREIGNKEYS view describes one foreign key for each table in the catalog.

The tables and columns that make up this view are provided in the SQL statement below. To learn more about a particular table or column, use the links provided beneath the view definition.

ALTER VIEW "SYS"."SYSFOREIGNKEYS"( foreign_creator,
  foreign_tname,
  primary_creator,primary_tname,role,columns) 
  as select fk_up.user_name,fk_tab.table_name,pk_up.user_name,
    pk_tab.table_name,fk.role,
    (select list(string(fk_col.column_name,' IS ',
      pk_col.column_name)) from
      SYS.SYSFKCOL as fkc join SYS.SYSCOLUMN as fk_col on(
        fkc.foreign_table_id = fk_col.table_id 
        and fkc.foreign_column_id = fk_col.column_id),
      SYS.SYSCOLUMN as pk_col where
      fkc.foreign_table_id = fk.foreign_table_id and
      fkc.foreign_key_id = fk.foreign_key_id and
      pk_col.table_id = fk.primary_table_id and
      pk_col.column_id = fkc.primary_column_id) from
    SYS.SYSFOREIGNKEY as fk join
    SYS.SYSTABLE as fk_tab on fk_tab.table_id = fk.foreign_table_id join
    SYS.SYSUSERPERM as fk_up on fk_up.user_id = fk_tab.creator join
    SYS.SYSTABLE as pk_tab on pk_tab.table_id = fk.primary_table_id join
    SYS.SYSUSERPERM as pk_up on pk_up.user_id = pk_tab.creator
See also