Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3360256
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:58:15+00:00 2026-05-18T02:58:15+00:00

Consider a link table with the following columns: PersonID int NOT NULL LocationID int

  • 0

Consider a link table with the following columns:

PersonID int NOT NULL
LocationID int NOT NULL
Active bit NOT NULL
...

The system allows each Person and Location to be configured independently. Once configured, each Person can be linked to at most one Location. If a Person moves to a new Location, the link is to be deactivated, not deleted, so that the system knows when the Person was last linked to a particular Location. A Person can have any number of inactive links, but at most one active link. A Location can have any number of Persons actively linked to it.

How would I add a constraint to this table to prevent a second active link from being created for a Person when one already exists?

Edit: I thought this was a 2008 box… turns out it’s 2005, so filtered indexes won’t work.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T02:58:15+00:00Added an answer on May 18, 2026 at 2:58 am

    Using an indexed view to implement a “filtered index” on versions of SQL Server predating 2008:

    CREATE VIEW vOnlyOneActive
    AS
      SELECT PersonID
      FROM <underlying table>
      WHERE Active = 1
    GO
    CREATE UNIQUE CLUSTERED INDEX IX_vOnlyOneActive on vOnlyOneActive (PersonID)
    GO
    

    You’ll need to have the right ANSI settings turned on for this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider the following table and its indexes: CREATE TABLE 'Interaction' ( 'oid' bigint(20) NOT
Consider the following markup: <!DOCTYPE html> <html> <head> <title>Test Page</title> <link href=screen.css rel=stylesheet />
Consider an indexed MySQL table with 7 columns, being constantly queried and written to.
Consider the following XML: <?xml version="1.0" encoding="utf-8"?> <treelist id="foo" displayname="display"> <treelink id="link" /> </treelist>
Let's consider the following table models for sqlalchemy in python. class Worker(Base): id Column(Integer,
Consider the following: #include <iostream> #include <cmath> int main() { using std::cout; using std::endl;
Consider this link from Amazon. If you notice, each seller has this block (similar,
While reading this link, I did not understand the point on avoiding table locks
Consider that there is a bunch of tables which link to countries or currencies
Consider the following setup: A windows PC with a LAN interface and a WiFi

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.