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 818351
In Process

The Archive Base Latest Questions

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

I have a table that has a composite key that consists of two int

  • 0

I have a table that has a composite key that consists of two int fields and one varchar(50) field. I made the composite key my primary key, which I don’t usually do. Yes, yes, yes, I’m more than familiar with the logical key vs. surrogate key debate, but I must have done some heavy drugs (not really) the day that I made the table since I went with the logical key approach instead of using a surrogate (which I almost always do).

My problem: LINQ won’t let me do an update on the varchar(50) column that is part of the composite key. It throws the exception “The property ‘Value’ is part of the object’s key information and cannot be modified.” ‘Value’ is the name of the field (and please don’t lecture me on using reserved words for column names… like I already said, I was on serious drugs the day of).

So where does this leave me, besides between a rock and a hard place? The table in question actually does have a unique, identity column (even though it’s not the primary key), and this column is being used in a foreign key to another table. So, duh, I can’t very easily do some hack like delete the record in question and re-add it, because that would force me to keep track of the fk’s in other tables and then re-add them as well. What a nightmare…

Anyone know an easy way to get around this issue without forcing me to make extensive changes to my table structure?

  • 1 1 Answer
  • 2 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-15T02:08:22+00:00Added an answer on May 15, 2026 at 2:08 am

    If you already have a unique IDENTITY column on that table, then it should be your primary key. Primary keys should always be a choice only between the minimum sized candidate (unique) keys in a table, and should almost always be immutable.

    You don’t even have to make your IDENTITY column the PRIMARY KEY on the database, you can just make it the key column in your Linq to SQL model, and everything should work just fine.

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

Sidebar

Related Questions

I have a table that has a primary key that's an INT... I have
I have a table with a primary key that is a varchar(255). Some cases
I have a JPA Entity StatsEntity which has a composite primary key that is
I have a table called table1 which has a composite primary key using 'ScreenId'
I have a table that has 8 million records, with many fields, including lat/long
I have a table that has an AUTO_INCREMENT field. Currently, it is also a
I have one table that has sales records and another table that has additional
Have a linking (or ref) table which has a dual primary key. Need to
I have two database tables: 'MyTable' which has a standard auto-incrementing primary key integer
I have two entities: Project, Employee Employee has primary key {employeeId} + some other

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.