你如何建立在SQL Azure中的外键? [英] How do you set up a foreign key in SQL Azure?

查看:136
本文介绍了你如何建立在SQL Azure中的外键?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你如何在SQL Azure中建立一个外键?

How do you set up a foreign key in SQL Azure?

我现在有一个数据库,在Azure系统。

I have a database now on the Azure system.

在数据库中的表有一个用途,例如,有一个主,逻辑上集中的表,然后有一些表,每个描述了主表中的一些列。例如,如果我在主表的年龄分类栏,我可能有一个单独的表中列出了年龄分类的某些类别(字符串)和一些相关的指标。然后,从年龄分类表索引将被用作在主表的引用

The tables in the database have an intended use such that there is one main, logically centralized table and then there are a number of tables which each describe some column in the main table. For example, if I have an age classification column in the main table, I might have a separate table which lists some categories of the age classification (as a string) and some associated index. Then the index from the age classification table would be used as a reference in the main table.

这是一个外键是什么?有没有在SQL Azure中的一些方法,使这些指标之间的关联?

Is this what a foreign key is? Is there some way in SQL Azure to make the association between these indexes?

推荐答案

是的 - 这是一个外键是什么。

yep - that's what a foreign key is.

也许最简单的方法是在SSMS查询窗口中使用T-SQL

Perhaps the easiest way is using t-sql in a SSMS query window

alter table MyTable
add constraint MyTable_MyColumn_FK FOREIGN KEY ( MyColumn ) REFERENCES MyOtherTable(MyOtherIDColumn)

(来源:如何创建一个外国在SQL Server关键?

SQL Azure是从在某些方面其他SQL服务器不同,但不能在这个简单的命令的条款。

SQL Azure is different from other SQL Servers in some respects, but not in terms of this simple command.

我发现href=\"http://sqlazuremw.$c$cplex.com/\"> SQL Azure迁移向导转换为正常的SQL天青SQL 的宝贵的

I found the SQL Azure Migration Wizard invaluable for converting 'normal' sql to Azure SQL.

这篇关于你如何建立在SQL Azure中的外键?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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