Can't delete a project

Wednesday, May 2, 2012 3:17:46 AM
Trying to delete a project from a partial/failed import from HP QC 10.

When I try the delete, ST says it can't. Application log shows:

APPLICATION.Business.DataAccess::ExecuteNonQuery: The DELETE statement conflicted with the REFERENCE constraint "FK_TST_PROJECT_TST_ARTIFACT_ATTACHMENT". The conflict occurred in database "SpiraTest", table "dbo.TST_ARTIFACT_ATTACHMENT", column 'PROJECT_ID'. The statement has been terminated. [System.Data.SqlClient.SqlException] Stack Trace: at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() 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 APPLICATION.Business.DataAccess.ExecuteNonQuery(String sqlCommand, Boolean useParam)
3 Replies
Thursday, May 24, 2012 9:39:15 AM
Avatar
re: hnwadmin on Wednesday, May 2, 2012 3:17:46 AM

To give specific support on this issue, please contact Inflectra support. It looks like an attachment that has gotten cross-linked across a project. There is a SQL command that should fix it:

DELETE FROM TST_ARTIFACT_ATTACHMENT WHERE PROJECT_ID = X

(where X is the ID of the project in SpiraTest)

Wednesday, July 25, 2012 2:06:45 PM
Avatar
re: inflectra.adam on Thursday, May 24, 2012
There is still a project I can't delete... Here is what we found in Application log:

we got several entries here just the first one (as pasting two much, fills up the capacity of the text field):

Error 1

 APPLICATION.Business.DataAccess::ExecuteNonQuery:

The DELETE statement conflicted with the REFERENCE constraint "FK_TST_PROJECT_ATTACHMENT_TYPE_TST_PROJECT_ATTACHMENT". The conflict occurred in database "SpiraTeam", table "dbo.TST_PROJECT_ATTACHMENT", column 'PROJECT_ATTACHMENT_TYPE_ID'.

The statement has been terminated. [System.Data.SqlClient.SqlException]

 

Stack Trace:

   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()

   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 APPLICATION.Business.DataAccess.ExecuteNonQuery(String sqlCommand, Boolean useParam)

 

Error 2

 APPLICATION.Business.Attachment::DeleteAllProjectAttachmentInfo: Database foreign key violation occurred [APPLICATION.Business.DataAccessForeignKeyException]

etc....

I have delete the only incident in that project, and the table dbo.TST_ARTIFACT_ATTACHMENT" does not contain any record for this project anymore.

What shall we try next?
Friday, July 27, 2012 7:08:26 PM
Avatar
re: ChristophBr on Wednesday, July 25, 2012
It looks like you have some project attachment types that have somehow gotten linked to attachments in a different project. You need to get a list of all the PROJECT_ATTACHMENT_TYPE_IDs in the project you're deleting and make sure that all attachments (TST_PROJECT_ATTACHMENT) in other projects are not using them.
Statistics
  • Started: Wednesday, May 2, 2012 3:17:46 AM
  • Last Reply: Friday, July 27, 2012 7:08:26 PM
  • Replies: 3
  • Views: 1116