Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
alejo46
Posting Yak Master
157 Posts |
Posted - 2012-02-14 : 13:57:41
|
Good afternoon, i've got a script that prints out related tables with their correspondent foreign keys, it works fine in sqlserver 2008 but in in sqlserver 2000 is not working. yielding the error:Server: Msg 208, Level 16, State 1, Line 1Invalid object name 'sys.sysforeignkeys'.Server: Msg 208, Level 16, State 1, Line 1Invalid object name 'sys.syscolumns'.i need that this script work fine in 2000, how do i find a similar one that works fine en sqlserver 2000? Id appreciate your helpthis is the script:Select object_name(rkeyid) Parent_Table, object_name(fkeyid) Child_Table, object_name(constid) FKey_Name, c1.name FKey_Col, c2.name Ref_KeyColFrom sys.sysforeignkeys sInner join sys.syscolumns c1on ( s.fkeyid = c1.id And s.fkey = c1.colid )Inner join syscolumns c2on ( s.rkeyid = c2.id And s.rkey = c2.colid )Order by Parent_Table,Child_Table |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-02-14 : 14:02:50
|
thats because sql 2000 does not have catalog viewsjust try replacing them with syscolumns and sysforeignkeys instead------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
|
|
|
|
|