locked
Is It Possible To Create a Diagram? RRS feed

  • Question

  • Hi,

    I’m trying to create a DB for my course at Uni and as far as I’m aware to create a DB on my desktop at home I need to use CE.

    So I created a new DB in CE and then created some tables and I now want to create a relationship diagram but there isn’t an option to do it. In the toolbar the relationship icon is permanently greyed out and unusable and there isn’t a node in object explorer.

    Can this be done and am I just missing something obvious? I’m running it on Vista and I have installed the latest SP, could that cause any problems?

    Im going crazy and any help would be greatly appreciated!

    Thanks,

    Ricky

    Thursday, March 22, 2007 5:24 PM

Answers

  • There is currently no designer support for building relationships between tables in SQL Server CE.  To build relationships you need to use SQL commands such as:

    ALTER TABLE Orders ADD FK_Customer_Order FOREIGN KEY (CustomerId) REFERENCES Customers(CustomerId)

    There are plans to add designer support for this with the next release of Visual Studio, codename "Orcas"

    Friday, March 23, 2007 8:20 AM

All replies

  • There is currently no designer support for building relationships between tables in SQL Server CE.  To build relationships you need to use SQL commands such as:

    ALTER TABLE Orders ADD FK_Customer_Order FOREIGN KEY (CustomerId) REFERENCES Customers(CustomerId)

    There are plans to add designer support for this with the next release of Visual Studio, codename "Orcas"

    Friday, March 23, 2007 8:20 AM
  • Ricky,

    1. You can download free copies of SQL Server 2005 Express SP2 with Advanced Services (SSX), which includes SQL Server Management Studio Express (SSMX), to your desktop from here.
    2. When you attach a sample database (e.g., Northwind.mdf) to SSX in SSMX, expand the DatabaseName node in Object Explorer to display the subnodes.
    3. Click Yes when asked if you'd like to add the extensions for database diagrams.
    4. Right-click the Database Diagrams node and choose New Database Diagram to open an Add Table dialog.
    5. Select all the tables you want to add to the diagram and click Add.
    6. Drag foreign key field nodes and drop them on primary key field nodes (or vice versa) to establish named foreign key constraints between the tables.

    HTH,

    --rj

    Friday, March 23, 2007 2:14 PM
  • Roger,

     

    You gave instructions that would work with a SQL Express database, not with the Compact Edition.  Erik had it right, so far you have to use SQL commands to create relationships, diagramming is not supported for CE databases even using the Management Studio.

    Friday, March 30, 2007 6:06 PM