Click here to Skip to main content
16,010,121 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
when I establised a relation i got this type of error

"Parent Columns and Child Columns don't have type-matching columns."

My table id is int and primary key and child table id is varchar.

please help me its urgent
Posted
Updated 12-Sep-11 0:59am
v3
Comments
Prerak Patel 12-Sep-11 6:59am    
C#?? or SQL?

you should make a reference between both tables on the same ID. So the childTable should have an int field that references to the parent table.
 
Share this answer
 
Both datatype should be same. Change child table id also to int or change main table id to varchar.
 
Share this answer
 
Change datatype of column
http://forums.asp.net/t/1585837.aspx/1[^]
 
Share this answer
 
Foreign Keys (on child tables) must match the type of primary key (on the parent table).

So you cannot have varchar referencing int.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900