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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T07:37:04+00:00 2026-05-18T07:37:04+00:00

I have a SQL DB in MS SQL Server 2008 R2 For development purposes,

  • 0

I have a SQL DB in MS SQL Server 2008 R2

For development purposes, I am trying to clear all the data – then add in my dummy data.

After some struggles with FK Constraints, and using

ALTER TABLE ? NOCHECK CONSTRAINT ALL
DELETE FROM ?
ALTER TABLE ? CHECK CONSTRAINT ALL

I managed to clear the data.

Now I want to add some dummy data.

Lets say we have 3 tables, Country, Address and Country_Address (linking address to country).

I have added data to Country and Address

But when I try to add to Country_Address:


No row was updated.

The data in row 1 was not committed.
Error Source: .Net SqlClient Data Provider.
Error Message: The INSERT statement conflicted with the FOREIGN KEY constraint


I am not quite sure why this is happening, because all I am doing is linking the newly added Country and Addresses – which both exist – so why is it conflicting with FK constraint?

From googling it has hinted that reseeding the tables may be required to fix this. Firstly i’m not 100% sure what reseeding means, I am assuming it is talking about resetting the autogenerated ID column.

I did notice when adding new records to Country or Address that they use int incremented from last record (which is now gone), e.g. start from id of 400

How can I add the data in?

  • 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-18T07:37:05+00:00Added an answer on May 18, 2026 at 7:37 am

    It sounds like you have an ID column in the Country and Address tables, and the values in Country_Address are the ID values that reference the other two tables. And, it appears that you already have data for Country_Address that has the original values for the referenced data.

    So, reseeding may be the solution. I assume that your tables look something like this.

    Country
    -------
    CountryID int identity(1, 1)
    Country varchar(100)
    
    Address
    -------
    AddressID int identity(1, 1)
    Address varchar(100)
    City varchar(100)
    

    It doesn’t matter exactly what columns exist for reseeding, except for the CountryID and AddressID columns in each table. The identity(1, 1) property indicates autonumbering starting at 1 and incrementing by 1. So, to reseed the Country and Address tables, you can do the following before adding data to the Country and Address tables:

    DBCC CHECKIDENT ('Country', RESEED, 1)
    DBCC CHECKIDENT ('Address', RESEED, 1)
    

    It probably isn’t necessary to run the command for Country_Address, unless it has a column with an identity property.

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

Sidebar

Related Questions

I have two named instances of SQL Server 2008 and am trying to set
Our database server is a SQL 2008 server. My colleagues all have XP service
I have tried SQL Server 2008 Management Studio and other third party tools to
I have looked at the SQL Server 2008 feature comparison matrix and it lists
anyone have script or procedures to install SQL Server 2008 Express, set up the
I'm using SQL Server 2008 Management studio viewing a 2005 server and have just
I am looking for SQL Server Profiler in SQL Server 2008 express edition.I have
SQL Server (2005/2008) Each of the below statements have the same result. Does anyone
I have a couple of tables in a SQL 2008 server that I need
I have a WinForm application built with VS 2008 (C#) and SQL Server Express

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.