Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Register Now and get your question answered!
Save Password
Forgot your Password?

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 creating tables
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

1 Posts

Posted - 03/13/2013 :  09:35:16  Show Profile  Reply with Quote

i am created two tables countries,states,in countries tables i took 10 state table i entered 12 values but the problem is it is executed only for ten values after that it showing an error.The error is

Msg 547, Level 16, State 0, Line 4
The INSERT statement conflicted with the FOREIGN KEY constraint "FK__States__State_Id__21B6055D". The conflict occurred in database "MYDEMO", table "dbo.Countries", column 'Country_Id'.

Thanks in Advance


Very Important crosS Applying yaK Herder

52326 Posts

Posted - 03/13/2013 :  10:12:49  Show Profile  Reply with Quote
you need to make sure the countryid value you enter for state table is one that exists in country table otherwise you will get the specified error.

SQL Server MVP

Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000