SQL Server (2008) Creating link tables with unique rows

Posted by peteski22 on Stack Overflow See other posts from Stack Overflow or by peteski22
Published on 2009-02-02T14:56:16Z Indexed on 2010/05/03 15:18 UTC
Read the original article Hit count: 202

Hi guys, I'm having trouble getting in touch with SQL Server Managemen Studio 2008! I want to create a link-table that will link an Event to many Audiences (EventAudience).

An example of the data that could be contained:

EventId | AudienceId

  4              1
  5              1
  4              2

However, I don't want this:

EventId | AudienceId

  4              1
  4              1

I've been looking at relationships and constraints.. but no joy so far!

As a sneaky second part to the question, I would like to set up the Audience table such that if a row is deleted from Audience, it will clear down the EventAudience link table in a cascading manner.

As always, ANY help/advice appreciated!

Thanks Pete

© Stack Overflow or respective owner

Related posts about sql-server

Related posts about database