如何在SQL Server 2005中创建复合唯一约束 [英] How to create Composite Unique Constraint in SQL Server 2005
本文介绍了如何在SQL Server 2005中创建复合唯一约束的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
最好,我想知道如何使用SQL Server Management Studio界面来做到这一点,但这并不是完全必要的。如果只是有一个脚本可以在制作完表后添加一个脚本,那就没问题了。
Preferably I would like to know how to do it using the SQL Server Management Studio interface but that isn't completely necessary. If you simply have a script to add one after a table is made that would be fine.
推荐答案
在SQL Server Management Studio中
In SQL Server Management Studio
- 转到对象资源管理器
- 选择表并打开其设计器(不记得了它的内容在2005年被称为-修改表还是什么?)
- 在表设计器中,从工具栏(带有小键的表)中选择管理索引和键图标
- 在其中添加新索引并为其命名,单击其唯一设置
- goto the Object Explorer
- pick your table and open its designer (can't remember what it was called in 2005 - Modify Table or something?)
- in the table designer, pick the "Manage Indexes and Keys" icons from the toolbar (the table with the little key)
- in there, add a new index and give it a name, click it's "Unique" setting
- 打开索引定义中的列列表,然后添加列想要加入索引
就是这样! :)
这篇关于如何在SQL Server 2005中创建复合唯一约束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文