insert into a table

S

Seema

I have two tables. Roles and Users. In Roles I have three columns iID(PK
First I fill data in Roles table then now I am trying to insert data in User
table it is giving me following error.

Msg 547, Level 16, State 0, Line 1
The INSERT statement conflicted with the FOREIGN KEY constraint
"FK_User_Role". The conflict occurred in database "DataFeed", table
"dbo.Role", column 'Id'.
The statement has been terminated.
 
G

Guest

I have two tables. Roles and Users. In Roles I have three columns iID(PK
First I fill data in Roles table then now I am trying to insert data in User
table it is giving me following error.

Msg 547, Level 16, State 0, Line 1
The INSERT statement conflicted with the FOREIGN KEY constraint
"FK_User_Role". The conflict occurred in database "DataFeed", table
"dbo.Role", column 'Id'.
The statement has been terminated.

So, you are trying to insert id of role in the User table which does
not exist in the Role table.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,071
Latest member
MetabolicSolutionsKeto

Latest Threads

Top