c***@gmail.com
2014-04-07 20:37:56 UTC
To return one table you use the optional extra;
exec sp_helpconstraint @objname=@mytable, @nomsg='nomsg'
The books online incorrectly details this as;
exec sp_helpconstraint @objname=@mytable, @nomsg='no_message'
Good luck./
exec sp_helpconstraint @objname=@mytable, @nomsg='nomsg'
The books online incorrectly details this as;
exec sp_helpconstraint @objname=@mytable, @nomsg='no_message'
Good luck./
Hello,
When I run sp_helpconstraint, I get back two recordsets. The first has one
row with the object name. The second recordset has multiple rows containing
the constraints for the table. Each foreign key has two rows. My question
is, how can I subsequently query that second recordset?
My thought is that I would want to dump the output into a temporary table
and go from there, but I don't know how to specify that I want to use the
second recordset to fill the temporary table.
Ultimately what I am trying to do is make a temp table or derived table that
holds a) the names of the table's fk's, b) the corresponding pk table's
name, and c) the corresponding pk table's pk column name. If there's a
better way to do this (which I'm sure there is), I'd love to hear your
thoughts. I'll continue to dig in BOL in the meantime.
Thanks,
Paul
When I run sp_helpconstraint, I get back two recordsets. The first has one
row with the object name. The second recordset has multiple rows containing
the constraints for the table. Each foreign key has two rows. My question
is, how can I subsequently query that second recordset?
My thought is that I would want to dump the output into a temporary table
and go from there, but I don't know how to specify that I want to use the
second recordset to fill the temporary table.
Ultimately what I am trying to do is make a temp table or derived table that
holds a) the names of the table's fk's, b) the corresponding pk table's
name, and c) the corresponding pk table's pk column name. If there's a
better way to do this (which I'm sure there is), I'd love to hear your
thoughts. I'll continue to dig in BOL in the meantime.
Thanks,
Paul