0

DNN version: 5.6.2

Tool: SQL Server Management Studio

Action: Copy database

Error: There are no primary or candidate keys in the referenced table 'Roles' that match the referencing column list in the foreign key 'FK_UserRoles_Roles'

I tried searching for this error online, but all searches lead to topics where this error is encountered while creating a foreign key to a non-unique column. In my case, the key is already created. I double-checked that the RoleId column is the primary key on the Roles table and it is indeed the column the foreign key 'FK_UserRoles_Roles' references.

Any help to fix this is appreciated. Alternatively, what will be a quick way to copy the structure and data of my database apart from the "Copy Database" option?

Thanks!

Apeksha
  • 485
  • 6
  • 23
  • 1
    I recommend doing a backup and restoring to a new database. – notandy Sep 05 '12 at 20:27
  • Thanks @notandy, I tried that and got it to work after a few modifications - since I was restoring to the same server, I had to change some options and specify different log names, etc. I would still like to understand the cause of the original issue though. – Apeksha Sep 05 '12 at 20:40

1 Answers1

0

There is also an aspnet_Roles table in the DotNetNuke database. This is part of the ASP.NET authentication provider. Your problem may be not migrating the data in both the aspnet_ tables as well as the DNN tables.

Bruce Chapman
  • 1,227
  • 3
  • 12
  • 19