My question from foreign key ?

If I try to add a Foreign key column in existing other tables then A  error is burned.

Msg 1769, Level 16, State 1, Line 62
Foreign key 'Cstaddress_id' references invalid column 'Cstaddress_id' in referencing table 'customer'.
Msg 1750, Level 16, State 0, Line 62
Could not create constraint or index. See previous errors.

So please give me the solution of this error.
Varun GaurAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Nitin SontakkeDeveloperCommented:
May be you should shown the both table structures or at least the relevant portion of the structures, without which it becomes difficult to help.

Is there a primary key (not likely) or a unique key defined on column cstaddress_id on table customer?

Is the datatype of column cstaddress_id in both the tables is identical?

Please review and revert. Share more details if error continues...
2
Vitor MontalvãoMSSQL Senior EngineerCommented:
Besides providing us with the table schemas, you should also provide us the command that you're trying to run to create the FK.
1
Ryan ChongCommented:
Foreign key 'Cstaddress_id' references invalid column 'Cstaddress_id' in referencing table 'customer'.
as stated in the error message.... it was a typo issue?

it seems that there is no column called as Cstaddress_id found in your table: customer

pls verify that.
1

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.