How to get the Foreign Keys creation script from the entire database? SQL Server 2008

Asked

Viewed 84 times

2

I wonder if there is a command that returns the script of creating the Foreign Keys in SQL server, as well as the command sp_helptext returns the script of creating views and stored procedures for example.

Thanks

1 answer

1


exec sp_helpconstraint <tabela>

return all dependencies that exist with this table and from this table.

  • I wonder if there is a command that already generates the script that can be directly executed, but in any case I think that with sp_helpconstraint I can already assemble what I need. Thanks

  • By the way, mark the answer as answered.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.