Duplicate definition troubleshooting in SQL Source Control

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?

0 out of 0 found this helpful
Have more questions? Submit a request