Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Administration
 How do you set up a foreign key in SQL Azure?

Author  Topic 

Xarzu
Starting Member

25 Posts

Posted - 2012-09-09 : 23:27:12
How do you set up a foreign key in SQL 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.

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

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-09-09 : 23:42:47
yep..that is typical scenario for foreign key usage.

you specify it using ALTER TABLE ...ADD CONSTRAINT.... statement

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -