How to see the latest relationship changes in a SQL 2000 database

I have a SQL Server 2000 database with a lot of PK / FK relationships changing over a period of time. Is there a way to get all the changes in relationships or additions to the database?

I tried this query that returns all ForeignKeys.

SELECT f.constid, OBJECT_NAME(f.fkeyid) AS 'FKTable', c1.[name] AS 'FKColumnName', OBJECT_NAME(f.rkeyid) AS 'PKTable', c2.[name] AS 'PKColumnName'
FROM sysforeignkeys f
INNER JOIN syscolumns c1
ON f.fkeyid = c1.[id]
AND f.fkey = c1.colid
INNER JOIN syscolumns c2
ON f.rkeyid = c2.[id]
AND f.rkey = c2.colid
ORDER BY constid
GO

I was hoping that the competition field would be consistent, so I could just look for everything that was done after a certain const. However, this is not the case; it does not seem to write constid in any sequential order.

+3
source share
2 answers

Not unless you have a replica somewhere and a tool like Redgate Compare.

+3
source

, , , .

+1

Source: https://habr.com/ru/post/1702756/


All Articles