Insert statement (please read again)

S

Seema

have two tables. Roles and Users. In Roles I have three columns iID(PK),
Role(varchar), Description(varchar).

In User table I have columns ID(PK,FK), Username(varchar),
Password(varchar), Role(int).
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

 have two tables. Roles and Users. In Roles I have three columns iID(PK),
Role(varchar), Description(varchar).

In User table I have columns ID(PK,FK), Username(varchar),
Password(varchar), Role(int).
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.

Again, it seems you tried to insert a record in the User table with
Role which is not presented in the Roles 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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top