1
Vote

Create Metadata Comparison Capability

description

Add possibility to generate metadata from any database by using queries.

Columns:
  • Ordinal Position
  • Data Type
  • Max Length
  • Precision
  • Scale
  • PrimaryKey flag
  • Nullable flag
After this info is extracted, there should be ability to compare schema with one stored in database and necessary actions being built to handle changes in schema.

comments

knyazs wrote Oct 10, 2016 at 2:31 AM

ORACLE:

SELECT C.TABLE_NAME, A.COLUMN_NAME
FROM ALL_CONS_COLUMNS A
JOIN ALL_CONSTRAINTS C ON A.CONSTRAINT_NAME = C.CONSTRAINT_NAME
WHERE C.CONSTRAINT_TYPE = 'P'

T-SQL:

SELECT TABLE_NAME, COLUMN_NAME
FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
WHERE OBJECTPROPERTY(OBJECT_ID(CONSTRAINT_SCHEMA + '.' + CONSTRAINT_NAME), 'IsPrimaryKey') = 1