如何查看SQL 2000数据库中的最近关系更改(How to See Recent Relationship Changes in SQL 2000 Database)

编程入门 行业动态 更新时间:2024-10-26 09:26:37
如何查看SQL 2000数据库中的最近关系更改(How to See Recent Relationship Changes in SQL 2000 Database)

我有一个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 GO

I 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.

更多推荐

本文发布于:2023-08-06 16:01:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1451153.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:数据库中   关系   SQL   Relationship   Database

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!