T-SQL Question PK/FK Relationship

Hi Guys,

I need urgent help. Here is my table structure in our DB

TableMAIN
ID,
Fname
Zip

ID (PK)
Constraint Foreign Key([ZIP) References [dbo].[id])

TableZip
ID, (IDentity (1,1))
Zip
CreateDate

ID(PK)

I am using Merge Statement, I am comparing data from my stating.TableA to Destination.TableA (Updating/Inserting)
However I am getting error "The Merge Statement conflicted with the FOREIGN KEY constraint......"

My question is. Are Zip coming from the new file should be in TableZIP folder and then Insert/Update into to TableMain, am I right? Not the ID from TableZIP to TableMain.
As per my understanding, Primary Foreign Key relation. One Table of Primary Key value should be in Foreign Key Table.

Correct me if I am wrong, I need to change PRIMARY KEY in TableZIp. Primary Key should be ZIP Instead of ID.

Please advise.

Maybe just a typo, but I don't think your foreign key is defined correctly. Should zip reference zip? Your post says zip references id.