开发者

How to get FK script from existing tables in SQL server?

Suppose I have many tables which have Foreign keys created.

I want to get o开发者_开发问答nly the scripts for those FKs like so:

ALTER TABLE dbo.MyTable ADD CONSTRAINT...

I've tried to use tools from Studio management, however, it returns the script and create table together. I only want to return the FK scripts.

How can I return only the FK scripts from an SQL table?


If you're using Management Studio, expand the Keys tree of the table you want to script for, right-click the Foreign Key and choose Script key as... CREATE from the menu.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜