Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Query error

Author  Topic 

mlawton40
Starting Member

15 Posts

Posted - 2008-03-16 : 13:27:07
I am trying to run a query to create some stored procedures but am getting the following error:

System.Data.SqlClient.SqlException: Violation of PRIMARY KEY constraint 'PK__aspnet_SchemaVer__08EA5793'. Cannot insert duplicate key in object 'aspnet_SchemaVersions'. Violation of PRIMARY KEY constraint 'PK__aspnet_SchemaVer__08EA5793'. Cannot insert duplicate key in object 'aspnet_SchemaVersions'. Violation of PRIMARY KEY constraint 'PK__aspnet_SchemaVer__08EA5793'. Cannot insert duplicate key in object 'aspnet_SchemaVersions'. Violation of PRIMARY KEY constraint 'PK__aspnet_SchemaVer__08EA5793'. Cannot insert duplicate key in object 'aspnet_SchemaVersions'. Violation of PRIMARY KEY constraint 'PK__aspnet_SchemaVer__08EA5793'. Cannot insert duplicate key in object 'aspnet_SchemaVersions'. Violation of PRIMARY KEY constraint 'PK__aspnet_SchemaVer__08EA5793'. Cannot insert duplicate key in object 'aspnet_SchemaVersions'. The statement has been terminated. The statement has been terminated. The statement has been terminated. The statement has been terminated. The statement has been terminated. The statement has been terminated. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at ASP.runsql_aspx.__Render__control1(HtmlTextWriter __w, Control parameterContainer)

Does anyone know what this Violation of PRIMARY KEY constraint 'PK__aspnet_SchemaVer__08EA5793'. Cannot insert duplicate key in object 'aspnet_SchemaVersions'. means?

Thanks, Mark

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2008-03-16 : 13:39:43
it means exactly what it tells you

a primary key is by default unique.
this means that you can't insert a row with the same PK value that already exists in the table.


_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
SSMS Add-in that does a few things: www.ssmstoolspack.com
Go to Top of Page

mlawton40
Starting Member

15 Posts

Posted - 2008-03-16 : 14:21:15
Thanks for that. I'm still not quite sure what this means because this sql script is simply taken from the aspnetdb already built so this should surely work?

It works locally but when i create a sql script of all the stored procedures on visual studio and then try and execute the script on my server it brings up the error. These stored procedures are default ones though.

Thanks, Mark
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2008-03-16 : 14:38:00
well you'll have to show us the stored procedure for us to help you further...

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
SSMS Add-in that does a few things: www.ssmstoolspack.com
Go to Top of Page
   

- Advertisement -