我有一个SQL Server 2000数据库,在特定的时间范围内有很多PK / FK关系变化。 有什么方法可以检索所有关系更改或添加到数据库?
我尝试了这个返回所有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我希望constid字段是顺序的,所以我可以只查找在特定的constid之后完成的任何事情。 然而事实并非如此,它似乎没有按任何顺序编写constid。
I have a SQL Server 2000 DB with a lot of PK/FK relationships changes in a specific time frame. Is there any way I can retrieve all the relationship changes or additions to a Database?
I tried this query which returns all the 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 GOI was hoping that the constid field would be sequential so I could just look for anything that was done after a specific constid. However that is not the case, it doesn't seem to write the constid in any sequential order.
最满意答案
不,除非你有某个地方的副本和像Redgate的比较工具。
No, not unless you have a replica somewhere and a tool like Redgate's Compare.
更多推荐
发布评论