MsSql Compact,对两列或更多列的唯一约束 [英] MsSql Compact, unique constraint on two and more columns

查看:31
本文介绍了MsSql Compact,对两列或更多列的唯一约束的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

伙计们!MsSql Compact 是否具有在两个或多个列上创建复合唯一索引(只是约束,而不是主键)的功能?

guys! MsSql Compact have feature to create composite unique index (just constraint, not primary key) on two or more columns both?

col 1 col21 21 2 - 插入/更新必须产生异常

col 1 col2 1 2 1 2 - insert/update must generate exception

我没有通过服务器资源管理器的设计器看到此功能

I don't see this feature via Server Explorer's designer

推荐答案

CREATE UNIQUE INDEX ixMultiCol ON MyTable (col1, col2);

这篇关于MsSql Compact,对两列或更多列的唯一约束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆