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

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

somu210
Starting Member

India
1 Posts

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

i am created two tables countries,states,in countries tables i took 10 values.in 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
somun

somun

visakh16
Very Important crosS Applying yaK Herder

India
52317 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
http://visakhm.blogspot.com/

Go to Top of Page
  Previous Topic Topic Next Topic  
 New 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.12 seconds. Powered By: Snitz Forums 2000