Forum Replies Created

Viewing post 1 (of 1 total)

  • RE: Function to List Primary Key Columns for a Table

    Here is an alternative using the INFORMATION_SCHEMA view.

    select column_name

    from information_schema.table_constraints join information_schema.key_column_usage on (information_schema.table_constraints.constraint_name = information_schema.key_column_usage.constraint_name)

    whereinformation_schema.table_constraints.table_name = @table_name

    and constraint_type = 'PRIMARY KEY'

Viewing post 1 (of 1 total)