A duplicate definition was found for the table

A SQL Server Management Studio add-in to source control your database in Subversion or Team Foundation Server.

Moderators: Chris Auckland, David Atkinson, sherr, PhilScrace

A duplicate definition was found for the table

Postby BrandonGalderisi » Wed Jul 07, 2010 9:54 pm

I am getting the following error:

A duplicate definition was found for the table [dbo].[XXXXXXXX]. Ensure that case sensitivity options are set correctly and all object creation scripts are valid. If the problem persists, contact our support.

This is a new database that I just created on my local box, connected to a new SVN project folder that I just created on the server.

Any help would be appreciated.
BrandonGalderisi
 
Posts: 15
Joined: Wed Jul 07, 2010 9:51 pm

Postby simon.jackson » Thu Jul 08, 2010 9:39 am

Hi,

Thanks for reporting the issue. The error indicates that there are two files under the directory the database is linked to which contain "Create table [dbo].[XXXXXXX]". One case this can happen is where you link to SomeFolder, and then copy it into itself, so you end up with

SomeFolder
SomeFolder\\Tables
SomeFolder\\Tables\\dbo.XXXXXX.sql
SomeFolder\\OldVersion
SomeFolder\\OldVersion\\Tables
SomeFolder\\OldVersion\\Tables\\dbo.XXXXXX.sql


Is it likely you have two copies of the create table file in source control? If so, can you see why? If you could email me a zip of the folder from source control ( to my username @red-gate.com) I should be able to see more of what's going on.
simon.jackson
 
Posts: 45
Joined: Thu Jan 08, 2009 10:42 am

Postby BrandonGalderisi » Thu Jul 08, 2010 3:32 pm

So if after I had SQL Source Control build my base project, I created an upgrade folder in which I housed my manually created version upgrade scripts, that would be the issue.

Because when we have a DB release, not only do we have the base file with the create table statements, but if we add a new table, we build and run a patch file which contains alter tables, create tables, and create procedures.

Is it possible to make an option to ignore a certain folder? It would obviously work best for my patch scripts to be in the same folder as my new deploy scripts.
BrandonGalderisi
 
Posts: 15
Joined: Wed Jul 07, 2010 9:51 pm

A duplicate definition was found for the table

Postby sherr » Tue Jul 20, 2010 7:48 pm

It's currently not possible to ignore a certain folder within SQL Source Control.

Is it possible to move your "upgrade" folder to a higher level that is not within the SQL Source Control directory? Maybe you could have a structure like:
- Database - high level root folder
-- SchemaChanges - Point SQL Source Control here
-- Upgrade - Use for your patch files

Have you tried using SQL Compare to deploy your changes? You can use SQL Compare to compare a scripts folder (if you get a version using your source control system) or your development database to a target database (e.g., Test/QA). SQL Compare will show you all the differences. You can then automatically generate a syncrhonization script, which will create all the ALTER statements for you. It will take care of dependencies and order as well. This can be ran directly on the target db or it can generate a script that you can open in SSMS and review yourself before executing.

I hope this helps!
Stephanie M. Herr :-)
SQL Source Control Project Manager
sherr
 
Posts: 126
Joined: Thu Mar 19, 2009 12:45 pm
Location: Cambridge

Postby BrandonGalderisi » Wed Jul 21, 2010 12:36 am

Thanks. I did move the upgrade folder to a different location outside of source control. For the time being, I am happy managing the upgrade file myself but maybe that will change. I know all about compare and have found it useful for finding things the developers try to sneak in.
BrandonGalderisi
 
Posts: 15
Joined: Wed Jul 07, 2010 9:51 pm


Return to SQL Source Control 1

Who is online

Users browsing this forum: No registered users and 1 guest