mirror of
https://github.com/dbgate/dbgate
synced 2024-11-08 12:47:25 +00:00
13 lines
690 B
JavaScript
13 lines
690 B
JavaScript
module.exports = `select
|
|
TABLE_CONSTRAINTS.CONSTRAINT_NAME as constraintName,
|
|
TABLE_CONSTRAINTS.TABLE_NAME as pureName,
|
|
KEY_COLUMN_USAGE.COLUMN_NAME as columnName
|
|
from INFORMATION_SCHEMA.TABLE_CONSTRAINTS
|
|
inner join INFORMATION_SCHEMA.KEY_COLUMN_USAGE
|
|
on TABLE_CONSTRAINTS.TABLE_NAME = KEY_COLUMN_USAGE.TABLE_NAME
|
|
and TABLE_CONSTRAINTS.CONSTRAINT_NAME = KEY_COLUMN_USAGE.CONSTRAINT_NAME
|
|
and TABLE_CONSTRAINTS.CONSTRAINT_SCHEMA = KEY_COLUMN_USAGE.CONSTRAINT_SCHEMA
|
|
where TABLE_CONSTRAINTS.CONSTRAINT_SCHEMA = '#DATABASE#' and TABLE_CONSTRAINTS.TABLE_NAME =[OBJECT_NAME_CONDITION] AND TABLE_CONSTRAINTS.CONSTRAINT_TYPE = 'PRIMARY KEY'
|
|
order by KEY_COLUMN_USAGE.ORDINAL_POSITION
|
|
`;
|