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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T13:17:24+00:00 2026-05-12T13:17:24+00:00

I have a little DB challenge for you. Hopefully you can help. The Problem:

  • 0

I have a little DB challenge for you. Hopefully you can help.

The Problem:

I need a solution that will allows me to “handle” changes to primary keys/ composite keys. By
“handle”, I mean I should still be able to perform CRUD operations with little or no code changes. It needs to have minimum hassle from an application/ database point of view.

I am allowed to use pretty much anything under the sun except for the 2 constraints as follows:
1) Need to use SQL Server
2) Not allowed to use dynamic SQL queries

My initial brainstorm/ Possible Solutions?

a) Can it be solved at stored procedure level somehow?

b) Can some sort of clever use of DTO with adapter pattern/ reflection/ DB schema interrogation solve this?

c) Some sort of fancy LINQ/ reflection trick?

d) Can NHibernate solve this somehow?

I am under a bit of time pressure (I have to come up with a solution before the end of the week) so any help will be appreciated. So, here it is. If you think you might have a solution but could not be bothered using any brain cells, here is an incentive (hopefully it will work)…if your solution solves the problem for me and I end up using it, you get fully licensed commercial (not pirated 😛 ) version of any Microsoft software of your choosing eg. Windows 7, SQL Server, Office 2007, etc. If the incentive does not work, I hope you’ll help me anyways? 🙂 Kind of desperate here 🙂

Thank you so much.

  • 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-12T13:17:25+00:00Added an answer on May 12, 2026 at 1:17 pm

    Suppose you have a record with a generated primary key – that’s just an immutable identifier for the record. An end user never need see it, but it allows you to reliably identify a record and hence specify changes to it.

    Other columns or combinations of columns are what the user thinks of as the PrimaryKey but really are not “primary” they are just (possibly unique) chnangeable pieces of data.

    So GivenName/FamilyName – nice fields perhaps for an index, but clearly changable.

    Social Security Number (or some such supposedly unique number) – sounds like a great primary key. Hmm but suppose somehow the wrong one gets into the system, how do you fix it. If it’s just a column with a unique index where’s the problem?

    The real primary key is the thing we use to join to other tables.

    User — User’s Orders

    Linked by the system generated primary key, not his mutable SSN-like thing.

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

Sidebar

Related Questions

I have little unusual problem to solve. I need some hint or links to
I have little snippet for validatin' my form. I need help to position the
I'm a little new to objective-C but have run across a problem that I
I have a little challenge. I have a report that I declared a parameter
I have little bit longer question for you - but hope answer will be
I have little problem with a replacement of a little part in an url.
I have little problem in regular expressin creation. Expected input: blahblahblah, blahblahblah, 'blahblahblah', blahblahblah,
So here is a little challenge. I have an image. It has 2 attributes:
I have a friend that has a little bit of a holiday coming up
i have little problem with boost::asio library. My app receive and process data asynchronously,

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.