Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_foreignkeys

  No additional text.


Syntax

create procedure sys.sp_foreignkeys
(
    @table_server       sysname,
    @pktab_name         sysname = null,
    @pktab_schema       sysname = null,
    @pktab_catalog      sysname = null,
    @fktab_name         sysname = null,
    @fktab_schema       sysname = null,
    @fktab_catalog      sysname = null
)
as
    select
        PKTABLE_CAT     = PK_TABLE_CATALOG,
        PKTABLE_SCHEM   = PK_TABLE_SCHEMA,
        PKTABLE_NAME    = PK_TABLE_NAME,
        PKCOLUMN_NAME   = PK_COLUMN_NAME,
        FKTABLE_CAT     = FK_TABLE_CATALOG,
        FKTABLE_SCHEM   = FK_TABLE_SCHEMA,
        FKTABLE_NAME    = FK_TABLE_NAME,
        FKCOLUMN_NAME   = FK_COLUMN_NAME,
        KEY_SEQ         = ORDINAL,
        UPDATE_RULE     =
                        case UPDATE_RULE
                            when 'CASCADE' then 0
                            when 'NO ACTION' then 1
                            when 'SET NULL' then 2
                            else null
                        end,
        DELETE_RULE     =
                        case DELETE_RULE
                            when 'CASCADE' then 0
                            when 'NO ACTION' then 1
                            when 'SET NULL' then 2
                            else null
                        end,
        FK_NAME         = convert(sysname, NULL),
        PK_NAME         = convert(sysname, NULL),
        DEFERRABILITY   = convert(smallint, null)

    from
        sys.fn_remote_foreign_keys (
                @table_server,
                @pktab_catalog,
                @pktab_schema,
                @pktab_name,
                @fktab_catalog,
                @fktab_schema,
                @fktab_name)
    order by FKTABLE_CAT, FKTABLE_SCHEM, FKTABLE_NAME, KEY_SEQ

 
Last revision 2008RTM
News

  Query a named instance
Sybase+ASE+silent+install
SQL 2008 R2
Deprecated procedures in SQL2008
Reporting Services item-level role definitions
Create all your missing indexes
Converting datetime field
Start MSSQL Server Profiler at time
Replicating MSSQL Server views
Exploring Microsoft Sharepoint
The OLE DB provider "SQLNCLI10" for linked server indicates.
Mobile solar charger
Oracle to SQL Server replication
Cannot insert the value NULL into column
Undocumented Microsoft SQL Server 2008
VMware
Zoekmachine optimalisatie
SQL Servers hidden objects
FckEditor
Flash in Ajax
De hype die AJAX heet
Barcode scannen
MySQL; Gratis, makkelijk en snel!
PHP
sIFR; de combinatie tussen HTML en Flash