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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T21:03:50+00:00 2026-05-16T21:03:50+00:00

Well, I’m sure this question has been asked before but I’m yet to find

  • 0

Well, I’m sure this question has been asked before but I’m yet to find a single solid answer to it. I’m in the process of creating a solution that involves remote offices uploading data to one master db via web service.
Basically, each office will have a windows service that runs every 1hr or so, picks up any new data into a dataset, connects to the server via http, and uploads the dataset. The server then imports the data and all is well. In theory it should work. Right.

Not really, so each office has a unique OfficeID, given to it by the server so as to keep them unique on the server. At first I thought I’d cracked it till I realised the problem with auto-increment PKs. You see, all the remote offices already have existing data and all their tables all have Auto-Increment PK’s and all associated constraints. Root/Parent Tables that have the OfficeID have no problem since it is already unique, the problem lies with the foreign keys since when they’ll reach the server, they’ll have a NewID and so the relationship with the child will lost.

At the moment I have only 2 solutions.

  1. Remove all auto-increment and unique PK constraints on the server db and use the OfficeID to filter out duplicate foreign ‘keys’. or…
  2. When importing the dataset, keep track of each row and it’s associated parent using stuff like Scope_Identity etc so that each child row is associated with the correct parent row.

Option 1 is looking much easier to implement since its less work for me, but I wonder about sql’s performance and also data integrity will be a problem since constraints cannot be enforced. Option 2 will keep things in check but Gosh the amount of code needed is mind boggling.

Are there any other options that I’m not considering? and if I only have the 2 above, which is the lesser of two evils.

Thanks
John

  • 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-16T21:03:50+00:00Added an answer on May 16, 2026 at 9:03 pm

    Use GUIDs as your primary keys. It’s not 100% foolproof (99. and a fairly large number of nines percent), and there is a performance penalty, but it is the easiest way of doing this while remaining sane.

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

Sidebar

Related Questions

Well, first I know that this question was already asked several times. But I
Well, I have to revive a question that was answered here before. I've made
well I'm starting to understand Android Fragments but this is still confusing for me.
This could be a duplicate question, but I have no idea what search terms
Well the title of this question might not actually reflect what I want, I
Well, not sure I am going to be able to write this out to
Well... simple question, right? But with no so simple answers. In firefox i use
Well, it seems simple enough, but I can't find a way to add a
Well I think this is kinda dumb but, I wonder if there's any way
Well friends, I have got this query which works but is very long for

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.