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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 retrieve sql definition for sysconstraints

Author  Topic 

vl
Starting Member

14 Posts

Posted - 2008-01-08 : 16:15:13
I am in the process of dropping some tables. But before doing that, I want to find out how many tables are referencing those tables.

I want to find out all the foreign key constraint's sql statement in order to know how many tables are referencing a particular table.

something like SYSCOMMENTS table the TEXT field, but it does not have foreign key constraints information.

I have try to load all the information from sp_helpConstraint table into temp table, but got the following error message.

Warning: The table '#ConstraintList' has been created but its maximum row size (12031) exceeds the maximum number of bytes per row (8060). INSERT or UPDATE of a row in this table will fail if the resulting row length exceeds 8060 bytes.


create table #ConstraintList
( record1 varchar(4000)
, record2 varchar(4000)
, record3 varchar(4000)
, row int identity )

insert #ConstraintList exec sp_helpConstraint Table_Name



Any suggestion will be appreciated.

Thanks,

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2008-01-08 : 22:51:12
You can just script the db including fkeys.
Go to Top of Page
   

- Advertisement -