Error deleting template (SQL helper exception in ExcuteNonQuery) v4.7
I have search around the forum but can not find previous posts. When we attempt to delete/remove a template that is no longer in use we are receiving the following error- Error handling action: Umbraco Exception (DataLayer): SQL helper exception in ExecuteNonQuery. If we create a new template and attempt to delete it immediately it works fine. There are several templates that can not be removed; however, they can be renamed and moved around (under different master templates, etc).
Setup info
Windows 2008 R2 IIS7.5 SQL Server 2005 SP3 Umbraco 4.7 (upgraded from original v4.5 installation to v4.6 then to v4.7)
Can confirm as well that the post from jivan helped me out. I had deliberately removed the template associations first because I thought that would have caused the error! Who would have thought...
I was facing the same problem. But assign any document type with the template we want to remove first. Then go back to that template and delete it. This worked for me.
Would love to fix it but I don't know how to reproduce the issue. If anyone can tell me what I'm missing I can have a look: http://issues.umbraco.org/issue/U4-2356
Here are some more detailed steps to reproduce this problem which still exists in 6.1.3. There are a few weird conditions I think others have been missing in trying to reproduce this. I just ran through this very carefully and can reproduce this 100% of the time now. Here's how:
Create a new Document Type called "Deleter Tester" and leave the "Create matching template" box checked.
Create a new document in your site based on this new DeleterTester document type. Name it "Deleter Doc".
Now hit the "Save and Publish" button to ensure this page gets published. (Note that the Audit Trail now has two saved versions of this document in the cmsDocument table.)
Go back to settings and edit the "Deleter Tester" document type. UNCHECK all allowed templates and save the document type.
Now go try to delete the "Deleter Tester" template. (In my case, this was created by default as an MVC view but same problem exists in older WebForms/master pages as well if I recall.) You will get a SQL Exception because of the foreign key reference from cmsDocument to cmsTemplate
The weird thing is this:
If you delete the "Deleter Doc" content node, and then purge it from the recycle bin, you can now delete the template. (Historical audit trail was wiped, no more database references to the cmsTemplate table.)
Or, if you go back to any document type and allow the "Deleter Tester" template as one of the choices, ... for some reason now when you try to delete the template, it somehow knows to clean up the old historical references in the cmsDocument table and actually lets you delete the template??
ironically after all this time and with the newest 6.2 install...this is still the fix, I can confirm you do indeed have to assign it (use it) before deletion can be completed. really awkward bug.
Error deleting template (SQL helper exception in ExcuteNonQuery) v4.7
I have search around the forum but can not find previous posts. When we attempt to delete/remove a template that is no longer in use we are receiving the following error- Error handling action: Umbraco Exception (DataLayer): SQL helper exception in ExecuteNonQuery. If we create a new template and attempt to delete it immediately it works fine. There are several templates that can not be removed; however, they can be renamed and moved around (under different master templates, etc).
Setup info
Windows 2008 R2 IIS7.5
SQL Server 2005 SP3
Umbraco 4.7 (upgraded from original v4.5 installation to v4.6 then to v4.7)
)
I've just come across the exact same issue.
Any ideas anyone?
Just come across the same issue too!
i too had this issue..
i tried deleting references(nodes at content section) related to the templates and even from recycle bin..
it worked
if you did not assign template. Open Any document type and assign template first. back to template and delete. it worked for me.
I just had the same problem. I couldn't find any references to the template being used within the content or doc type structure.
Jivan's answer worked for me. I just assigned the template to one of the doc types and then I was able to delete the template.
Cheers,
Matt
At the risk of sounding like a 'me-to', I can also confirm Jivan's answer sorted out the problem.
Close call - nearly resorted to tweaking the database - yikes!
Wow, weird bug. And it's still there with 4.7.1
Can confirm as well that the post from jivan helped me out. I had deliberately removed the template associations first because I thought that would have caused the error! Who would have thought...
Could also be related to this: http://umbraco.codeplex.com/workitem/29306
Jeroen
I was facing the same problem. But assign any document type with the template we want to remove first. Then go back to that template and delete it. This worked for me.
Worked for me too, but does the business rule follow? Wouldn't you want to only be able to delete non-linked objects?
Over a year later and Jivan's solution worked for me on version 4.9.1.
Dont u get a more detailed description in the log ? should tell u what relation it has problems with.
Same problem on 4.11.5, Jivan's answer corrected the problem. Maybe this is an issue that needs looking into?
Same problem on v6.0.3, Jivan's solution worked
Worked for me too. Thanks!
Robert
Unbelievably this is still true in 6.11!
Would love to fix it but I don't know how to reproduce the issue. If anyone can tell me what I'm missing I can have a look: http://issues.umbraco.org/issue/U4-2356
Here are some more detailed steps to reproduce this problem which still exists in 6.1.3. There are a few weird conditions I think others have been missing in trying to reproduce this. I just ran through this very carefully and can reproduce this 100% of the time now. Here's how:
Create a new Document Type called "Deleter Tester" and leave the "Create matching template" box checked.
Create a new document in your site based on this new DeleterTester document type. Name it "Deleter Doc".
Now hit the "Save and Publish" button to ensure this page gets published. (Note that the Audit Trail now has two saved versions of this document in the
cmsDocument
table.)Go back to settings and edit the "Deleter Tester" document type. UNCHECK all allowed templates and save the document type.
Now go try to delete the "Deleter Tester" template. (In my case, this was created by default as an MVC view but same problem exists in older WebForms/master pages as well if I recall.) You will get a SQL Exception because of the foreign key reference from
cmsDocument
tocmsTemplate
The weird thing is this:
If you delete the "Deleter Doc" content node, and then purge it from the recycle bin, you can now delete the template. (Historical audit trail was wiped, no more database references to the
cmsTemplate
table.)Or, if you go back to any document type and allow the "Deleter Tester" template as one of the choices, ... for some reason now when you try to delete the template, it somehow knows to clean up the old historical references in the
cmsDocument
table and actually lets you delete the template??So. There you go! Hope this helps....
Nice work, Funka - great to have a definitive way of showing this in action. Hopefully it will help get it fixed.
Umbraco v6.1.6 (Assembly version: 1.0.5021.24867)
Same problem, same solution :-)
Umbraco v 7.0.4 (Assembly version:1.0.5161.21054 )
Same problem, same solution... :-)
Here anyone reported this ??
Yes, I reported it here -> http://issues.umbraco.org/issue/U4-2356
Kinda felt that no one believed me, though :)
think I've fixed this in a pull request - https://github.com/umbraco/Umbraco-CMS/pull/379
was a highly anoying bug!
Woohoo - nice work, Mark! #h5yr
ironically after all this time and with the newest 6.2 install...this is still the fix, I can confirm you do indeed have to assign it (use it) before deletion can be completed. really awkward bug.
is working on a reply...