Home All Groups Group Topic Archive Search About

Can not create relationship; SQL server 2008 Express

Author
16 Mar 2009 3:14 PM
jpBless
I am using the management studio tool that came with SQL server 2008 Express
Edition. Problem is the relationship button is greyed out on the toolbar.
How do I create relationship (between tables) in SQL 2008 Express... also
what do I need to set to enable the (greyed out) relationship button?

Thanks in advance
Author
16 Mar 2009 3:54 PM
Aaron Bertrand [SQL Server MVP]
This is one reason why it's good to know the syntax instead of relying on a
graphical tool that might not always work (never mind that you can't store
those pointies and clickies in source control).

CREATE TABLE dbo.Customers(CustomerID INT PRIMARY KEY);

CREATE TABLE dbo.Orders(OrderID INT PRIMARY KEY,
    CustomerID INT FOREIGN KEY REFERENCES dbo.Customers(CustomerID));





On 3/16/09 11:14 AM, in article ummT2nkpJHA.5***@TK2MSFTNGP03.phx.gbl,
Show quoteHide quote
"jpBless" <jp3blessNoSpam@hotmail.com> wrote:

> I am using the management studio tool that came with SQL server 2008 Express
> Edition. Problem is the relationship button is greyed out on the toolbar.
> How do I create relationship (between tables) in SQL 2008 Express... also
> what do I need to set to enable the (greyed out) relationship button?
>
> Thanks in advance
>
>
Are all your drivers up to date? click for free checkup

Author
16 Mar 2009 7:29 PM
jpBless
Thanks for responding... I am trying to adapt the sample code to create
relationshiption between tables. I was hoping there is a GUI tool I could
use use to drag-and-drop. Thanks for the help.



Show quoteHide quote
"Aaron Bertrand [SQL Server MVP]" <ten.xoc@dnartreb.noraa> wrote in message
news:C5E3EE68.1338F%ten.xoc@dnartreb.noraa...
> This is one reason why it's good to know the syntax instead of relying on
> a
> graphical tool that might not always work (never mind that you can't store
> those pointies and clickies in source control).
>
> CREATE TABLE dbo.Customers(CustomerID INT PRIMARY KEY);
>
> CREATE TABLE dbo.Orders(OrderID INT PRIMARY KEY,
>    CustomerID INT FOREIGN KEY REFERENCES dbo.Customers(CustomerID));
>
>
>
>
>
> On 3/16/09 11:14 AM, in article ummT2nkpJHA.5***@TK2MSFTNGP03.phx.gbl,
> "jpBless" <jp3blessNoSpam@hotmail.com> wrote:
>
>> I am using the management studio tool that came with SQL server 2008
>> Express
>> Edition. Problem is the relationship button is greyed out on the toolbar.
>> How do I create relationship (between tables) in SQL 2008 Express... also
>> what do I need to set to enable the (greyed out) relationship button?
>>
>> Thanks in advance
>>
>>
>
Author
16 Mar 2009 11:22 PM
Erland Sommarskog
jpBless (jp3blessNoSpam@hotmail.com) writes:
> Thanks for responding... I am trying to adapt the sample code to create
> relationshiption between tables. I was hoping there is a GUI tool I could
> use use to drag-and-drop. Thanks for the help.

There is a GUI tool, but it's questionable that it is less work
than learning to type the commands.

And the table designer that comes with Mgmt Studio is quite crappy. There
are some horrible bugs in it when it comes to modifying existing tables.

--
Erland Sommarskog, SQL Server MVP, esq***@sommarskog.se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
Author
18 Mar 2009 2:10 PM
Itamar
On Mar 16, 5:14 pm, "jpBless" <jp3blessNoS***@hotmail.com> wrote:
> I am using the management studio tool that came with SQL server 2008 Express
> Edition. Problem is the relationship button is greyed out on the toolbar.
> How do I create relationship (between tables) in SQL 2008 Express... also
> what do I need to set to enable the (greyed out) relationship button?
>
> Thanks in advance

You can use a 3rd party tool, like this query tool :
http://nobhillsoft.com/MarieAlix.aspx

Bookmark and Share