Monday, March 26, 2012

Relations

Maybe a stupid question but...

is it posible to add relations in sql compact databases (.sdf) ?

I tried in server explorer (in orcas) and there is no option for relations. Also .sdf file cannot be opened in SQL Server Express Management Studio SP2 because is version 3.5.

This SQL code will do the trick:

Code Snippet

ALTERTABLE EQMetaData ADDCONSTRAINT FK_Reference FOREIGNKEY([EQID])REFERENCES Equipments ([ID])

In version 3.5 there will be a GUI for modifying relations, but for now you must use SQL code.

sql

No comments:

Post a Comment