Red Gate forums :: View topic - Error: A duplicate definition was found for the stored proc
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SQL Source Control 2
SQL Source Control 2 forum

Error: A duplicate definition was found for the stored proc

Search in SQL Source Control 2 forum
Post new topic   Reply to topic
Jump to:  
Author Message
gvar369



Joined: 23 Feb 2011
Posts: 11

PostPosted: Fri May 27, 2011 5:55 pm    Post subject: Error: A duplicate definition was found for the stored proc Reply with quote

Hi,

SQL Source control gave me this error, after i commited couple of new SP's and Tables to the source control.
My environment:
SQL Server 2008, Sourcegear Vault Professional, SQL Source Control 2.1.0.31

I've already reported about this error through the SQL Source Control error reporting tool, but haven't received any response to it.

Following is the complete error details,

Code:
RedGate.SQLSourceControl.Engine.SqlCompareException: A duplicate definition was found for the stored procedure <stored_procedure>. Ensure that case sensitivity options are set correctly and all object creation scripts are valid. If the problem persists, contact our support. ---> #8rg.#7rg: A duplicate definition was found for the stored procedure <stored_procedure>. . Ensure that case sensitivity options are set correctly and all object creation scripts are valid. If the problem persists, contact our support. ---> #8rg.#7rg: A duplicate stored procedure name (<stored_procedure>) has been found. This may occur if the SQL Server that you are registering is case sensitive but the case sensitive option is not set. ---> System.ArgumentException: An item with the same key has already been added.
   at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
   at RedGate.SQLCompare.Engine.KeyedCollection`1.Add(T value)
   at RedGate.SQLCompare.Engine.SerializableDatabaseObjectCollection`1.Add(T value)
   --- End of inner exception stack trace ---
   at RedGate.SQLCompare.Rewriter.Analysis.Analyser`1.#KPz(Exception exception)
   at RedGate.SQLCompare.Rewriter.Analysis.Analyser`1.WaitForBackgroundThread()
   at #Eyg.#Gyg.#CGh(FileInfo file)
   at #Eyg.#Gyg.#vl()
   --- End of inner exception stack trace ---
   at #Eyg.#Gyg.#vl()
   at RedGate.SQLCompare.Engine.Database.Register(String path, ScriptDatabaseInformation dbinfo, Options options)
   at #G3c.#L3c.#t.#A2.#m36()
   at #oEc.#7Jf.#gKf(Action )
   --- End of inner exception stack trace ---

Server stack trace:
   at #oEc.#7Jf.#gKf(Action )
   at #oEc.#7Jf.#t.#z2.#rkW()
   at #oEc.#2aV.#hKf(ICancellableOperationStatus , ICancellable , Action )
   at #oEc.#7Jf.#jKf(ICancellableOperationStatus , ICancellable , Action )
   at #G3c.#L3c.#l36(String , #x36 )
   at #G3c.#K3c.#83c(String , #O9U )
   at #G3c.#L3c.#f6c(String , ScriptDatabaseInformation , Options , ICancellableOperationStatus )
   at #oEc.#VXM.#t.#WXM.#f6c(String )
   at #oEc.#VXM.#t.#WXM.#UtV()
   at RedGate.SQLSourceControl.Engine.Cancellables.CancellableOperation.#t.#izb.#j5f()
   at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
   at System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(RuntimeMethodHandle md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
   at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)

Exception rethrown at [0]:
   at System.Runtime.Remoting.Proxies.RealProxy.EndInvokeHelper(Message reqMsg, Boolean bProxyCase)
   at System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(Object NotUsed, MessageData& msgData)
   at RedGate.SQLSourceControl.Engine.Action.EndInvoke(IAsyncResult result)
   at RedGate.SQLSourceControl.Engine.Cancellables.CancellableOperation.#zIc(ICancellableOperationStatus , Pair`2[] )
   at #oEc.#VXM.#t.#WXM.#rYM()
   at #oEc.#VXM.#t.#WXM.#qYM()
   at #oEc.#VXM.#t.#XXM.#zYM(ToCommitChangeSet& toCommitChangeSet)
   at #oEc.#VXM.#mYM[#eTb](Func`2 , ICancellableOperationStatus , IReadOnlySourceControlServerCallBacks )
   at #oEc.#VXM.#jYM(ICancellableOperationStatus , IReadOnlySourceControlServerCallBacks )
   at #oEc.#4Ec.#7Jc(ICancellableOperationStatus , IReadOnlySourceControlServerCallBacks )
   at #oEc.#4Ec.#t.#u3.#ofA(ICancellableOperationStatus )
   at RedGate.SQLSourceControl.Engine.Cancellables.MutexedCancellableOperation`1.#t.#u3.#k5f()
   at RedGate.SQLSourceControl.Engine.Cancellables.CancellableOperationBase.InvokeWithTracker(Action action)
   at RedGate.SQLSourceControl.Engine.Cancellables.MutexedCancellableOperation`1.Invoke()
   at #eEc.#Qlg.Invoke()
   at #JLc.#PLc.#t.#Jfb.#EJf()
   at RedGate.SQLSourceControl.Engine.SmartAssembly.ExceptionReporting.ErrorReporterBase.Do(Action , Predicate`1 , Boolean )
   at RedGate.SQLSourceControl.Engine.SmartAssembly.ExceptionReporting.ErrorReporterBase.DoWithObviousExceptionsRethrowAll(Action action)
   at RedGate.SQLSourceControl.CommonUI.Forms.ErrorDialog.DoWithObviousExceptionsRethrowAll(Action action)
   at #JLc.#PLc.#CTc(ICancellableOperation`1 , Object )


Let me know if you need any further information, as i need this thing to be resolved as quickly as possible.

Thanks,
Vijay
Back to top
View user's profile Send private message
AndrewBA



Joined: 27 Oct 2009
Posts: 12
Location: West Perth

PostPosted: Mon May 30, 2011 1:56 am    Post subject: Me too! Reply with quote

I have also received this error this morning - strange because everything seemed to be working OK on Friday afternoon.

I am fully up-to-date with Windows updates, and have tried rolling back to v1.1. Other developers attaching to the same SVN repository are having the same issue.

I created a new SVN folder and linked my database to it. This worked for a while and then came back with the same error.

My instance default collation is Latin1_General_CI_AS, my db collation is SQL_Latin1_General_CP1_CI_AS.

The error only happens on 1 of my SourceControl db's.

What exactly does 'Ensure that case sensitivity options are set correctly and all object creation scripts are valid' mean and how can I proceed?

Windows 7 Pro SP1 x64, SQL Server 2008, SVN, SQL Source Control 2.1.0.31 (I recently updated to the 14 day trial of this)
Back to top
View user's profile Send private message
james.billings



Joined: 16 Jun 2010
Posts: 1113
Location: My desk.

PostPosted: Mon May 30, 2011 9:22 am    Post subject: Reply with quote

This error will generally occur if there are multiple files that contain the create SQL for the object in question within your SVN repo.

This can occur if a developer makes a backup of a script in SVN for instance - as SQL Source Control parses the whole folder structure, if there is more than one file that "creates" an object, then it doesn't know which to use and you get the error. It can also occur if a file has multiple object creation statements.

So, you need to check through your repo for any files that may reference the object the error refers to and remove the invalid ones.

You'll also then need to check your workingbases and transients for the same thing (or just unlink + relink which should give you new sets of those)
Back to top
View user's profile Send private message
AndrewBA



Joined: 27 Oct 2009
Posts: 12
Location: West Perth

PostPosted: Tue May 31, 2011 1:58 am    Post subject: Reply with quote

Thanks for the response, this was indeed the problem.
Back to top
View user's profile Send private message
gvar369



Joined: 23 Feb 2011
Posts: 11

PostPosted: Tue May 31, 2011 4:22 pm    Post subject: Reply with quote

Thanks james, I tried to unlink and relink the database, it solved my problem. But i guess, the problem started when i changed the schema of a SP.
Will try to do the same things i did before the source control crashed and will let you know if thats causing the problem.

Vijay
Back to top
View user's profile Send private message
AndrewBA



Joined: 27 Oct 2009
Posts: 12
Location: West Perth

PostPosted: Wed Jun 01, 2011 6:30 am    Post subject: Reply with quote

As a follow up to this; I automatically create a "CreateDatabaseObjects.sql" script from the SourceControl db object scripts in SVN. The create objects script was in the database directory that SourceContol is linked to and I think that SourceContol found it and threw the duplicate objects error.
Back to top
View user's profile Send private message
james.billings



Joined: 16 Jun 2010
Posts: 1113
Location: My desk.

PostPosted: Wed Jun 01, 2011 11:58 am    Post subject: Reply with quote

Yes, that would almost certainly be it. If you are going to have extra "maintenance" scripts they need to be stored above the folder you're linking to, otherwise SQL Source Control will try to parse it and you'll encounter this kind of problem.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group