You get the error "A duplicate definition was found for the table..."
The duplicate error is usually caused by unnecessary files in your repository which have resulted in duplicate CREATE statements for an object. In most cases, the files were added manually to the repository. It's important that the repository that SQL Source Control (SOC) uses doesn't contain anything else apart from files generated by SOC.
1. Make sure you are on the latest version of SQL Source Control (Help>Check for updates).
2. To find the offending file, you can search your repository for all the CREATE statements for the object referenced in the error.
First check the Transient folder which is a representation of the source control repository.
Go to Setup > Under The Hood > Open Transient
3. If you have Notepad++ you can use the Search > Find in Files option to search the folder for instances of the CREATE string or object name.
The search produces results for potentially multiple definitions.
Double click on these entries to open the full object and see the DDL.
4. This example shows two duplicate create statements for what looks like two difference objects. You'll need to delete the duplicate from the repository directly, e.g. this could be your Azure DevOps repo, BitBucket, Github.
5. Unlink and relink the database from SOC to refresh your working copies and transient copies.
If the problem persists please log a ticket with support and attach a zipped copy of the Working Base and Transient Folders of the database where you are experiencing this issue.
Was this article helpful?
Articles in this section
- The process cannot access the file 'C:\Users\*******\AppData\Local\Red Gate\SQL Source Control 7\Caches
- Duplicate definition troubleshooting in SQL Source Control
- The target principal name is incorrect
- SQL Source Control can't access this database - make sure the database is online and you have permission to access it
- Meanings of the colored dots in the SSMS Object Explorer for SQL Source Control
- Last Changed By column shows Unknown
- How to Link SQL Source Control to TFS
- How to link to an existing SVN repository
- GIT Push/Pull greyed out
- Objects changed by unknown