Search code examples
mysqlsql-serverframeworksmigrationentity

duplicate objects in sql server


This is a long story and I am a little bit stack, I have tried many things and I was able to move forward, question is what now?

This is the full story:

I started working in a .net core project, 2.1. I installed for that visual studio 2019 and other tools. The important thing is that I installed SQL Server 2017 developers edition (the free one) with the default parameters, that version created an instance called MSSQLServer. Unfortunately, the project needed a different instance name which was MSSQL2017, so I tried to change the name of the instance, I couldn't because it is a free version, reinstalling it did not work either and a few other things that I tried, the important one is that a colleague changed the default sql string to make it compatible with my installation, in order to see if the problem was the setup or something else. It worked, and the tables and database was created for that project. So I managed to create another instance calling it with the proper name MSSQL2017, created the users and so on. When I go to Ms SQL Server Manager Studio, I notice that the tables are not created, so I run profile and run the project again, and this is what I get 'Cannot insert duplicate key row in object 'sys.syssingleobjrefs' with unique index 'clst'. The duplicate key value is (67439, 76, 101).' and that's when I am lost, I can't find what sys.syssingleobjrefs refers to so I have no idea how to move on to fix this mess. Any help? update: so sys.syssingleobjrefs is a system base table, that I can't see its content, how do I modify it?

select * from sys.syssingleobjrefs does not work


Solution

  • syssingleobjrefs is a system table accessible only through Administrator mode.
    You have to use sqlcmd -A in order to access this table.

    https://learn.microsoft.com/en-us/sql/relational-databases/system-tables/system-base-tables?view=sql-server-ver15