@Hrishikesh K M It sounds like you're trying to get a comprehensive view of the metadata associated with your tables in Azure Synapse Analytics, especially the relationships and descriptions that aren't captured in the INFORMATION_SCHEMA views.
For relationships between tables, you won’t find this data directly in the INFORMATION_SCHEMA. Instead, you may need to look into database diagrams or a specific metadata table if your setup supports it.
Please consider below steps and confirm us
Review Database Diagrams: If you’ve created any diagrams in your SQL Server Management Studio (SSMS), these can showcase relationships visually.
Check sys.foreign_keys
: This system view contains information about foreign key relationships. You can run a query like this to retrieve some relationship info:
SELECT
fk.name AS ForeignKey,
tp.name AS ParentTable,
cp.name AS ParentColumn,
tr.name AS ReferencedTable,
cr.name AS ReferencedColumn
FROM
sys.foreign_keys AS fk
JOIN
sys.foreign_key_columns AS fkc ON fk.object_id = fkc.constraint_object_id
JOIN
sys.tables AS tp ON fkc.parent_object_id = tp.object_id
JOIN
sys.columns AS cp ON fkc.parent_object_id = cp.object_id AND fkc.parent_column_id = cp.column_id
JOIN
sys.tables AS tr ON fkc.referenced_object_id = tr.object_id
JOIN
sys.columns AS cr ON fkc.referenced_object_id = cr.object_id AND fkc.referenced_column_id = cr.column_id
Using Extended Properties: You can also store descriptions and additional metadata using extended properties in SQL Server. Here’s how you can query them:
SELECT
obj.name AS ObjectName,
p.name AS PropertyName,
CAST(value AS NVARCHAR(MAX)) AS PropertyValue
FROM
sys.extended_properties p
JOIN
sys.objects obj ON p.major_id = obj.object_id
WHERE
obj.type IN ('U'); -- 'U' stands for user tables
For capturing additional metadata during the addition of new tables, consider implementing a standard operating procedure where you document relationships and descriptions as part of your deployment workflow.