首页 > 数据库

针对SQL Server约束增强的两点建议

时间:2009-05-06 17:04:00  作者:武树伟  我要投稿
Linux初探欢迎您的投稿,投放方法请点击这里查看,我们会定期赠送精美小礼品给优秀的投稿作者。海纳百川 取则行远!LinuxGoo欢迎您的到来。
Two suggestions to enhance constraints in SQL Server Alexander Kuznetsovhttp://sqlblog.com/blogs/alexander_kuznetsov/archive/2009/05/04/two-suggestio......
Alexander Kuznetsov

http://sqlblog.com/blogs/alexander_kuznetsov/archive/2009/05/04/two-suggestions-to-enhance-constraints-in-sql-server.aspx

We can tuck any logical expressions in CHECK constraints, but all foreign keys are currently capable of right now is to verify that one or more column values are equal. In many cases it would be very useful to have foreign keys use more complex logical expressions. Also in some cases the ability to create constraints on indexed views would be very handy too. I will provide examples and hopefully we will come up with Connect items to vote for.

When more complex logical expressions in foreign keys are useful

Consider the following simple common sense rule: the maximum current of your device cannot exceed the maximum current of the circuit you plug it into. Suppose that the following tables store data about circuits and devices:

如果您需转载 针对SQL Server约束增强的两点建议,请注明来自LinuxGoo.com,其版权归原作者所有。请广大网友留言时遵纪守法,使用文明用语。如果您在应用中有什么问题,请在下面留言,我们会尽快解答。
来顶一下
近回首页
返回首页
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表
相关文章
栏目热门