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

  • Home
  • SEARCH
  • 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 628651
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T19:39:35+00:00 2026-05-13T19:39:35+00:00

I am trying to memorize some sql syntax and I have gotten the ALTER

  • 0

I am trying to memorize some sql syntax and I have gotten the ALTER TABLE ADD CONSTRAINT syntax down. I believe I am correct when I say that when you use this syntax to add a FOREIGN KEY or PRIMARY KEY constraint, that sql server automatically creates indexes to support the constraint operations. (Is that true…or is it only true on the PK but not the FK?)

If so, when you use the ALTER TABLE DROP CONSTRAINT syntax…are the supporting indexes automatically dropped as well? Can these implicit supporting indexes be explicitly dropped? If so is the CONSTRAINT automatically removed?

I am just wanting to know how it works “under the covers”. Googling has not helped. I imagine I could have queried some sys tables to discover the truth but thought I would try here instead.

Thanks for your help.

Seth

  • 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-13T19:39:36+00:00Added an answer on May 13, 2026 at 7:39 pm

    When you add a primary key, a unique index is in fact added. Whether that addition caused the new index to be clustered depends on whether you specified that it be non-clustered or not. If in adding a primary key constraint, you do not specify that it is clustered nor non-clustered, it will be clustered if a clustered constraint or index does not already exist on the table otherwise it will be non-clustered.

    When you add a foreign key, no index is automatically created.

    When you drop a constraint, any indexes created as a result of the constraint creation will be dropped. However, if you attempt to drop a unique or primary key constraint and there are foreign key constraints that reference it, you will get an error.

    Indexes created as a result of constraint creation cannot be deleted using DROP INDEX.

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

Sidebar

Ask A Question

Stats

  • Questions 333k
  • Answers 333k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Create other column/field in the same table called position or… May 14, 2026 at 3:11 am
  • Editorial Team
    Editorial Team added an answer Does replacing a character in a String with a null… May 14, 2026 at 3:11 am
  • Editorial Team
    Editorial Team added an answer $('#sidebar').userProfile(); jQuery.fn.userProfile = function() { var elem = this; $.get('/users/profile',… May 14, 2026 at 3:11 am

Related Questions

I was looking at a job posting recently and one of the requirements was
I am trying to set a javascript date so that it can be submitted
I am trying to grab the capital letters of a couple of words and
I am trying to set a flag to show or hide a page element,
I am trying to generate a report by querying 2 databases (Sybase) in classic

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.