Table Relationships SQL server 08 express

Creating Table Relationships with SQL server 08 express in vis web dev

Page 1 of 1

2 Replies - 3917 Views - Last Post: 28 June 2010 - 09:36 AM Rate Topic: -----

#1 Kacie  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 15
  • Joined: 01-November 06

Table Relationships SQL server 08 express

Posted 27 June 2010 - 08:25 PM

OK so I have never ever touched asp.net and have absolutly no idea what I am doing. I create database structures via SQL Scripts not GUI enviornments. So I am trying to learn ASP.NET and I have started an MVC Web App project.

I have an account table and an address table and an account_addresses_xref table.

account
account_id
name
status_id
blah blah blah

addresses
address_id
city
state
blah blah blah

account_addresses_xref
account_id
address_id

Creating these tables was fairly easy. I now want to make them constrained to each other. So I right clicked the account_id field on the xref table and chose 'relationships', It says to click "Tables and Columns Specifications" so I did. It askes for the Primary Key table in which I choose "accounts". It had defaulted the Forien key table to "account_addresses_xref" naturally. I click OK and it tells me "The new relationship must have at least on pair of realted columns"....oooook so I click "Help" and it tells me "The relationship must relate at least one column from the foreign-key table to at least one column in the primary key table. Select a column from each table or delete the relationship" -- OK I don't see where I can do this, I thought that is what I was doing.

Is there a way I can just write out my database structure in a script and run it and not have to use this crap?


Please advise both questions, how do I create relationships through the GUI and how do I hack in my own damn SQL script. Thanks in advance.

This post has been edited by Kacie: 28 June 2010 - 09:34 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Table Relationships SQL server 08 express

#2 eclipsed4utoo  Icon User is offline

  • Not Your Ordinary Programmer
  • member icon

Reputation: 1524
  • View blog
  • Posts: 5,960
  • Joined: 21-March 08

Re: Table Relationships SQL server 08 express

Posted 28 June 2010 - 05:43 AM

If you are doing this from Visual Studio, I would suggest you download SQL Server Management Studio Express and use that.

Also, since this has nothing to do with ASP.Net(or .Net for that matter), I am moving it to the database forum.
Was This Post Helpful? 0
  • +
  • -

#3 Kacie  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 15
  • Joined: 01-November 06

Re: Table Relationships SQL server 08 express

Posted 28 June 2010 - 09:36 AM

I figured it out, I didn't have any primary keys set, once I did, the column matching drop downs appeared. Thanks for putting this in the correct place, I wasn't sure.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1